Skip to content

Instantly share code, notes, and snippets.

@johndevs
Last active April 12, 2017 15:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johndevs/11184881 to your computer and use it in GitHub Desktop.
Save johndevs/11184881 to your computer and use it in GitHub Desktop.
Sample build.gradle template for Gradle Vaadin Plugin projects
/**
* Applies the latest version of the Vaadin plugin to the project. If a specific
* version of the plugin is wanted, append "?version=0.7" to the url.
*/
apply from: 'http://plugins.jasoft.fi/vaadin.plugin'
/**
* The vaadin extension configures different aspects of how the vaadin plugin behaves
* in the project.
*/
vaadin {
/**
* Defines what version of Vaadin the plugin should use. The version can be
* defined as a specific number (7.1.13) or as a string where '+' means the latest.
*
* This version is used by the plugin to automatically add the right Vaadin dependencies
* to the project.
*
* The default is the latest version of Vaadin 7.
*/
version '7.1.+'
/**
* The path to the GWT module (Widgetset) gwt.xml file defined as a classname.
*
* This parameter is used by the updateWidgetset task to automatically generate the xml
* file on demand.
*
* By default the widgetset is defined as null meaning the application is a server side
* only project without a widgetset.
*/
widgetset 'com.example.MyExampleWidgetset'
/**
* The classname to the Widgetset generator class that can configure different kinds of
* lazy loading optimizations to the Vaadin application.
*
* By default this is null which means that the Widgetset generator provided by Vaadin
* is used.
*
* Using this property requires that the widgetset is not null and that manageWidgetset
* is turned on.
*/
widgetsetGenerator 'com.example.MyExampleWidgetsetGenerator'
/**
* Defines if the application should run in debug mode.
*
* Debug mode affects many aspects of the Vaadin application itself.
*
* Some of the aspects are, but not limited to:
* - Debug Window is available when appending &debug to application url
* - Java debugger is attached to Java process when running application with vaadinRun task
* - Java assertions are turned on with the -ea parameter
* - Application is automatically launced with the &debug parameter when running the
* application with the vaadinRun task
* - Vaadin Application shows communication and other errors with bright red popops
*
* By default debug mode is turned on to ease development. For production it is recommended
* that debug mode is turned off.
*/
debug true
/**
* The port of the Java debugger attached to the Java process when launching the application
* with the vaadinRun task.
*/
debugPort 8000
/**
* The Vaadin Profiler helps profile rendering speeds in client side Vaadin applications.
*
* By defualt the profiler is turned on.
*
* This setting only works if manageWidgetset is set to true and widgetset is not null.
*/
profiler true
/**
* Should the plugin manage the widgetset by automatically generating a gwt.xml file.
*
* This flag controls the following aspects of the widgetset handling:
* - Creates the gwt.xml file on demand whenever the widgetset needs updating
* - Allows the plugin to scan the classpath for Vaadin Add-ons and include any addon widgetsets
* into the project.
* - Adds necessary linkers for handling SCSS in client side applications
* - Configures many properties defined in build.gradle.
*
* By default manageWidgetset is turned on.
*/
manageWidgetset true
/**
* Should the plugin add the required repositories for fetching the vaadin dependencies.
*
* By default this is turned on so no external repositories need to be manually defined.
*/
manageRepositories = true
/**
* Should the plugin add the required Vaadin depenendencies to the project automatically.
*
* By defualt this is turned on so no external dependencies need to be added before creating a Vaadin application.
*/
manageDependencies true
/**
* The port on which the embedded Jetty server should run when running the vaadinRun task.
*/
serverPort 8080
/**
* Extra JVM arguments passed to the Java process when running the widgetset or vaadinRun tasks.
*/
jvmArgs()
/**
* Should Vaadin Push be enabled.
*
* By default Vaadin's Push implementation is not enabled as most applications will never need push.
* Turning on push adds the necessary Vaadin push dependency (if manageDependencies is enabled) for using Vaadin's
* push implementation in the Vaadin application.
*/
push false
/**
* Defines the main source set to use when generating new classes.
*
* By default this is in src/main/java
*/
mainSourceSet sourceSets.main.java
/**
* Configurations for the GWT compiler used by Vaadin to compiler the browser implementation
*/
gwt {
/**
* The compilation style of the Javascript produced by the GWT compiler
*
* Possible options are OBF[USCATED], PRETTY, or DETAILED. Default is OBF
*/
style "OBF"
/**
* Level of optimizations done by the GWT Compiler.
*
* Possible values ranges from 0 to 9 where 0 is no optimization and 9 is maximum level of optimizations. Default is 0.
*/
optimize 0
/**
* Is client side logging enabled for the project. Default is true.
*/
logging true
/**
* The level of logging in client side code.
*
* Possible values are ERROR, WARN, INFO, TRACE, DEBUG, SPAM, or ALL. Default is INFO
*/
logLevel "INFO"
/**
* The amount of workers that should compile the widgetset simultaniously.
*
* By default this is the amount of CPU cores that are available.
*/
localWorkers 1
/**
* Draft compile allows for faster recompiles of the widgetset
*
* By default this is off.
*/
draftCompile true
/**
* Strict compiling fails the compilation on any error and provides better error messages.
*
* By defailt this is off.
*/
strict true
/**
* The browsers that the Vaadin application should support
*
* By default this is null which signifies all supported browsers
*/
userAgent 'ie8,ie9,ie10,gecko1_8,safari,opera'
/**
* Extra JVM arguments passed to the GWT compiler
*/
jvmArgs()
/**
* Extra GWT compiler arguments
*/
extraArgs ''
/**
* Paths where the GWT Compiler should search for client side code.
*
* By default the compiler will search in the 'client' and 'shared' packages.
*/
sourcePaths('client', 'shared')
/**
* Should all GWT Permutations be collapsed into one permutation for
* larger filesize but faster compile time.
*
* Default is off.
*/
collapsePermutations true
/**
* Extra GWT modules that should be added to the widgetset.
*/
extraInherits()
}
/**
* Configurations for running Developement Mode
*/
devmode {
/**
* Should the Jetty server included with Development Mode be used.
*
* Usually you don't want this, by default off.
*/
noserver false
/**
* Should the experimental "Super" Development Mode feature be enabled.
* Might be good for javascript debugging, but usually not worth it.
*
* By default off.
*/
superDevMode false
/**
* To what address should the development mode be attached.
*
* By default attaches itself to localhost.
*/
bindAddress '0.0.0.0'
/**
* On what port should the development mode be run on. Default is 9997.
*/
codeServerPort 9997
}
/**
* Configrations for Vaadin addon projects
*/
addon {
/**
* The name of the author of the project
*/
author ''
/**
* The licence of the project.
*/
license 'Apache 2.0'
/**
* The title of the project as it will be shown in the Vaadin Directory.
*/
title 'My Project'
}
/**
* Configurations for enabling Testbench unit testing
*/
testbench {
/**
* Should testbench testing be enabled for the the project.
*
* Remember that by turning this to true you agree to the licence terms
* required by Vaadin Testbench. Vaadin Testbench is a commercial product
* developed by Vaadin.
*
* By default false.
*/
enabled false
/**
* The version of testbench you want to use. The version will automatically be
* included as a dependency to the project if manageDependencies is true.
*
* By default the latest version 3 release.
*/
version '3.+'
/**
* When the Testbench unit test is run should the vaadin application be started
* with the embedded Jetty server (same as running the application with vaadinRun).
*
* When this is set to true the server is started when the test is started and shutdown
* when the test ends.
*
* By default this is true.
*/
runApplication true
/**
* Defines configuration options for running a Testbench hub
*/
hub {
/**
* Should the hub be enabled and started when running tests.
*
* By default this is false since normally you want to have a central hub running somewhere
* on the intranet which all test runners contacts.
*/
enabled false
/**
* The host on which the hub should run on. By default localhost.
*/
host 'localhost'
/**
* The port on which the hub should be run on. By default 4444.
*/
port 4444
}
/**
* Defines configuration options for running a Tesbench node.
*/
node {
/**
* Should the node be enabled and started when running tests
*
* By default this is false since normally you want to have nodes already running on the intranet
* which the hub can contact without needing to start the node every time a test is run.
*/
enabled false
/**
* The host on which the node runs. By default localhost.
*/
host 'localhost'
/**
* The port on which the node is run. By default 4445.
*/
port 4445
/**
* The URL of the hub where the node should register itself.
*
* By default the hub running on localhost is assumed.
*/
hub 'http://localhost:4444/grid/register'
/**
* Which browsers does the node support.
*
* An example of a browser configuration could look like this:
*
* browsers([
* [ browserName: 'firefox', version: 3.6, maxInstances: 5, platform: 'LINUX' ],
* [ browserName: 'chrome', version: 22, maxInstances: 1, platform: 'WINDOWS' ]
* ])
*
* See http://code.google.com/p/selenium/wiki/Grid2 for more information about available browsers and
* settings. The browser setting will be stringingified into the -browser parameter for the hub.
*
* By default no browsers are configured.
*/
browsers()
}
}
/**
* Configurations for enabled JRebel with the project
*/
jrebel {
/**
* Should using JRebel be enabled.
*
* If you enable the JRebel intergration you agree to the terms and conditions set by
* ZeroTurnaround (http://zeroturnaround.com) and you will need a valid licence for the product.
*/
enabled false
/**
* The absolute file path of the jrebel.jar provided by the JRebel installation package. Required
* for JRebel to work.
*/
location ''
}
/**
* Misc. plugin configurations
*/
plugin {
/**
* Should the server started by the vaadinRun or devmode tasks be terminated by Enter key.
*
* By default the servers can be terminated with the Enter key.
*/
terminateOnEnter true
/**
* Should all logs be piped to the console or logged to file under the build directory.
*
* By default all logging are done to file.
*/
logToConsole false
/**
* When launching the application with vaadinRun should the application automatically be
* launched in the default browser.
*
* By default the application is opened in the browser when the server is run.
*/
openInBrowser true
}
}
@marcfasel
Copy link

Hi looks like the location of the plugin changed? This does not work:
apply from: 'http://plugins.jasoft.fi/vaadin.plugin

@twissmueller
Copy link

twissmueller commented Apr 12, 2017

You might want to try this:

plugins {
  id "fi.jasoft.plugin.vaadin" version "1.1.8"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment