First, you may want some pretty basic gretty setup:
buildscript {
repositories {
// You can declare any Maven/Ivy/file repository here.
mavenCentral()
jcenter()
}
dependencies {
classpath 'org.akhikhl.gretty:gretty:1.4.0'
}
}
apply plugin: 'war'
apply plugin: 'java'
apply plugin: 'org.akhikhl.gretty'
gretty {
servletContainer = 'jetty9'
httpEnabled = true
httpPort = 8081
contextPath = '/WebServer'
jvmArgs { '-ea' }
loggingLevel = 'ALL' // options: 'ALL', 'DEBUG', 'ERROR', 'INFO', 'OFF', 'TRACE', 'WARN'
}
Once you have that, you can setup a webapp in a farm. Specify the path to your war file here (the provided example is where the GWT plugin is putting mine).
farm {
webapp 'build/libs/web_server.war'
}
To specify the dependency:
project.afterEvaluate {
tasks.farmRun.dependsOn myCustomWarTask
}
Once you have all this in place, 'gradle farmRun' will build and run your war file in Gretty.