We use a build.gradle file similar to the following for most of our
GWT client projects:
(Note: We use './gradlew :gwts' to run SDM and './gradlew :build
:farmRun' to run a local http server)
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'gwt'
apply plugin: 'eclipse'
apply plugin: 'eclipse-wtp'
apply plugin: 'org.gretty'
apply plugin: 'maven'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
if (JavaVersion.current() > JavaVersion.VERSION_1_8) {
tasks.withType(JavaCompile) {
options.compilerArgs.addAll(["--release", "8"])
}
}
compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'
farm {
webapp ':'
}
buildscript {
repositories {
jcenter()
maven { url '
https://repo.spring.io/plugins-release' }
maven { url
"https://plugins.gradle.org/m2/" }
maven { url '
https://jitpack.io' }
}
dependencies {
classpath 'org.wisepersist:gwt-gradle-plugin:1.+'
classpath "gradle.plugin.org.gretty:gretty:3.0.3"
}
}
war {
archiveName 'client.war'
rootSpec.exclude('WEB-INF/classes/**/*.class')
rootSpec.exclude('WEB-INF/classes/**/*.gwt.xml')
}
gretty {
httpPort = 8080;
servletContainer = 'tomcat9'
managedClassReload = false
reloadOnClassChange = false
extraResourceBase 'build/gwt/out'
jvmArgs = ['-Dfile.encoding=UTF-8', '-Xmx2048M', '-Ddebug=true'
]
redeployMode='redeploy'
}
repositories {
jcenter()
maven { url '
https://jitpack.io' }
}
gwt {
logLevel = 'INFO'
maxHeapSize = "8192M";
//gwtVersion='2.8.2'
gwtVersion='2.9.0'
modules 'com.project.Module'
compiler {
disableClassMetadata = false;
strict = true;
style = "OBF";
//style = "PRETTY";
localWorkers = 4;
}
superDev {
noPrecompile = true;
failOnError = false;
bindAddress = "0.0.0.0";
}
eclipse {
addGwtContainer = true;
}
}
configurations {
provided
}
dependencies {
gwt 'com.google.gwt:gwt-user:'+gwt.gwtVersion
providedCompile 'com.google.gwt:gwt-servlet:'+gwt.gwtVersion
gwt 'com.google.elemental2:elemental2-dom:1.0.0'
gwt 'com.google.elemental2:elemental2-core:1.0.0'
gwt 'com.google.elemental2:elemental2-promise:1.0.0'
gwt 'com.ekotrope:gwt-completablefuture:1.0.0'
providedCompile 'javax.servlet:javax.servlet-api:3.0.1'
compile 'javax.ws.rs:javax.ws.rs-api:2.1.1'
gwt 'org.fusesource.restygwt:restygwt:2.2.+'
gwt "com.fasterxml.jackson.core:jackson-annotations:2.9.6"
gwt "com.fasterxml.jackson.core:jackson-databind:2.9.6"
gwt 'com.google.code.findbugs:jsr305:3.0.0' //required for
restygwt compile
gwt 'com.github.nmorel.gwtjackson:gwt-jackson:0.15.2'
gwt ('com.google.gwt.eventbinder:eventbinder:1.1.0') {
//exclude module: 'gwt-user'
}
gwt 'javax.xml.bind:jaxb-api:2.3.+'
}
task "create-dirs" {
doLast{
sourceSets*.java.srcDirs*.each { it.mkdirs() }
sourceSets*.resources.srcDirs*.each { it.mkdirs() }
}}
eclipseJdt {
doLast{
File f = file('.settings/org.eclipse.core.resources.prefs')
f.write('eclipse.preferences.version=1\n')
f.append('encoding/<project>=utf-8')
f = file('.settings/org.eclipse.core.runtime.prefs')
f.write('eclipse.preferences.version=1\n')
f.append('line.separator=\\n\n')
}}
eclipse {
project {
name = 'My Project'
webAppDirName = 'src/main/webapp'
}
classpath {
downloadSources = true
downloadJavadoc = true
}
jdt {
sourceCompatibility=1.8
targetCompatibility=1.8
}
wtp {
facet {
facets = []
facet name: 'jst.java', version: '1.8'
facet name: 'jst.web', version: '3.0'
facet name: 'com.gwtplugins.gwt.facet', version: '1.0'