===================
This plugin helps to build GWT project with Gradle. The main goals is build webapps and libraries.
Why to use it?
- DevMode on standalone Jetty 9 container.
- DevMode works with multi module project.
- Ease of use.
- Gradle is faster and easier than Maven
- Java 7 or higher.
- Gradle 2 or higher. https://gradle.org
- First you need java and gradle installed on your workstation.
- Init your project with this structure
/ build.gradle
/ src
|-- main
|-- java
|-- resources
|-- webapp
|-- test
|-- java
|-- resources
- You can init the project with those commands
PROJECT_NAME={your-project}
mkdir $PROJECT_NAME
cd $PROJECT_NAME
mkdir -p src/main/java src/main/resources src/main/webapp
mkdir -p src/test/java src/test/resources
touch build.gradle
- Apply the plugin fr.putnami.gwt in your build.gradle file
apply plugin: 'fr.putnami.gwt'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'fr.putnami.gwt:putnami-gradle-plugin:0.1.2'
}
}
repositories {
mavenCentral()
}
putnami{
module 'your.gwt.module.to.compile'
}
- Then use the commands below:
gradle gwtRun
To run the webappgradle gwtDev
To run the DevModegradle build
To compile GWT and Build the webapp
Notes
To use the lastest snapshot you can add maven{ url 'https://oss.sonatype.org/content/repositories/snapshots/' }
to the buildscript repositories.
We offer you 3 build samples:
- Library project : Simple library project pgp-sample-lib.
- WebApp project : Simple GWT project pgp-sample-webapp.
- Multi-modules project : Project composed with a library and a webapp pgp-sample-multimodules.
The Putnami Gradle Plugin is usefull either to build GWT's library or webapp.
- apply plugin: 'fr.putnami.gwt-lib' : To build a library. This plugin installs properly all the GWT dependencies on your project and adds the java sources into the target jar artifact.
- apply plugin: 'fr.putnami.gwt' : To build a webapp. This plugin installs properly all the GWT dependencies and provide all the usefull tasks helping you to work efficiently on your projects.
- Common configuration
putnami{
/** Module to compile, can be multiple **/
module 'fr.putnami.gradle.sample.multimodule.app.App'
/** GWT version **/
gwtVersion = "2.7.0";
/** Add the gwt-servlet lib **/
gwtServletLib = true;
/** Add the gwt-elemental lib **/
gwtElementalLib = false;
/** Jetty version **/
jettyVersion = "9.2.7.v20150116";
}
- gwtCompile Compile the GWT webapp.
Can be tuned with the following parametters:
putnami{
compile {
/** The level of logging detail (ERROR, WARN, INFO, TRACE, DEBUG, SPAM, ALL) **/
logLevel = INFO
/** Compile a report that tells the "Story of Your Compile". **/
compileReport = true
/** Compile quickly with minimal optimizations. **/
draftCompile = true
/** Include assert statements in compiled output. **/
checkAssertions = false
/** Script output style. (OBF, PRETTY, DETAILED)*/
style = "OBF"
/** Sets the optimization level used by the compiler. 0=none 9=maximum. **/
optimize = 5
/** Fail compilation if any input file contains an error. **/
failOnError = false
/** Validate all source code, but do not compile. **/
validateOnly = false
/** Specifies Java source level. ("1.6", "1.7")*/
sourceLevel = "1.7"
/** The number of local workers to use when compiling permutations. **/
localWorkers = 2
/** The number of local workers to use when compiling permutations. **/
localWorkersMem = 2048
/** Emit extra information allow chrome dev tools to display Java identifiers in many places instead of JavaScript functions. (NONE, ONLY_METHOD_NAME, ABBREVIATED, FULL)*/
methodNameDisplayMode = "NONE"
/** Specifies JsInterop mode, either NONE, JS, or CLOSURE. **/
jsInteropMode = "NONE"
/**
* Java args
*/
maxHeapSize="1024m"
minHeapSize="512m"
maxPermSize="128m"
debugJava = true
debugPort = 8000
debugSuspend = false
javaArgs = "-Xmx256m", "-Xms256m"
}
}
- gwtRun Compile the GWT webapp and run the jar on Jetty 9
Note : This task depends on the gwtCompile task.
Can be tuned with the following parametters:
putnami{
jetty {
/** interface to listen on. **/
bindAddress = "127.0.0.1"
/** request log filename. **/
logRequestFile
/** info/warn/debug log filename. **/
logFile
/** port to listen on. **/
port = 8080
/** port to listen for stop command. **/
stopPort = 8089
/** security string for stop command. **/
stopKey = "JETTY-STOP"
/**
* Java args
*/
maxHeapSize="1024m"
minHeapSize="512m"
maxPermSize="128m"
debugJava = true
debugPort = 8000
debugSuspend = false
javaArgs = "-Xmx256m", "-Xms256m"
}
}
- gwtDev Run the CodeServer (SDM) and Jetty 9
The SDM is tuned with the following parametters, the jetty is configured from the previous configuration.
putnami{
dev {
/** Allows -src flags to reference missing directories. **/
allowMissingSrc = false
/** The ip address of the code server. **/
bindAddress = "127.0.0.1"
/** Stop compiling if a module has a Java file with a compile error, even if unused. **/
failOnError = false
/** Precompile modules. **/
precompile = false
/** The port where the code server will run. **/
port = 9876
/** EXPERIMENTAL: Don't implicitly depend on "client" and "public" when a module doesn't define anydependencies. **/
enforceStrictResources = false
/** Specifies Java source level ("1.6", "1.7").
sourceLevel = "1.6"
/** The level of logging detail (ERROR, WARN, INFO, TRACE, DEBUG, SPAM, ALL) **/
logLevel = "INFO"
/** Specifies JsInterop mode (NONE, JS, CLOSURE). **/
jsInteropMode = "JS"
/** Emit extra information allow chrome dev tools to display Java identifiers in many placesinstead of JavaScript functions. (NONE, ONLY_METHOD_NAME, ABBREVIATED, FULL) **/
methodNameDisplayMode = "NONE"
/**
* Java args
*/
maxHeapSize="1024m"
minHeapSize="512m"
maxPermSize="128m"
debugJava = true
debugPort = 8000
debugSuspend = false
javaArgs = "-Xmx256m", "-Xms256m"
}
}
We need you! Any help is welcome. And there is many ways to help us:
If you tried and you love PWT. We will be glad to count you as community members. So please :
- Star this project and become one famous stargazers
- Become a follower on twitter
- Join the news group putnami-web-toolkit
Of course you will get all our thankfulness if you blog, share and spread PWT around you. All the backlinks on http://putnami.org are very welcome.
All issues about bugs or enhancement are precious and will be given careful consideration. We're going to help you in the best delay as can (generally in the day time).
To report an issue, please use the project issue tracker
You'd love to contribute your code, nice :) First be sure that your code respect the project code style and formating. All the documentation is here
If you are an eclipse user, it could be nice if you follow the workspace setup instructions.
Every pullrequest will be review with a great consideration, and with a full open mind.
The framework is delivered under LGPL v 3.0.
The LGPL v 3.0 allows a free usage of PWT for commercial and open source projects. We equally guarantees that PWT is and will open source for ever.
PWT doesn't affect the license of your application. Using PWT is free of charge so fill free to use and integrate it.
You can have a look at the licence details on a https://www.gnu.org/licenses/lgpl-3.0.txt.
We hope that this plugin will help you to build great apps.
Best regards.