Starting with version 1.0.0, Gretty supports unified interface to the servlet containers
Jetty 7, 8 and 9, Tomcat 7 and 8. There’s only one plugin to include: org.akhikhl.gretty
.
apply plugin: 'war' // optional if you use spring-boot
apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin'
gretty {
// supported values:
// 'jetty7', 'jetty8', 'jetty9', 'tomcat7', 'tomcat8'
servletContainer = 'jetty9'
}
or, without "gretty.plugin":
buildscript {
repositories {
mavenLocal()
jcenter()
}
dependencies {
classpath 'org.akhikhl.gretty:gretty:+'
}
}
apply plugin: 'war'
apply plugin: 'org.akhikhl.gretty'
gretty {
// supported values:
// 'jetty7', 'jetty8', 'jetty9', 'tomcat7', 'tomcat8'
servletContainer = 'jetty9'
}
If you are using Gretty farms, the configuration of servlet container is very similar:
apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin'
farm {
// supported values:
// 'jetty7', 'jetty8', 'jetty9', 'tomcat7', 'tomcat8'
servletContainer = 'jetty9'
}
Here are the versions for each servletContainer value:
servetContainer |
Servlet container version |
Servlet API version |
jetty7 |
Jetty 7.6.14.v20131031 |
2.5 |
jetty8 |
Jetty 8.1.8.v20121106 |
3.0.1 |
jetty9 |
Jetty 9.2.1.v20140609 |
3.1.0 |
tomcat7 |
Tomcat 7.0.54 |
3.0.1 |
tomcat8 |
Tomcat 8.0.8 |
3.1.0 |
When you run generic tasks (appRun, appStart, …), servletContainer property fully defines
on which servlet container your web-app will run. However, you can use more specific tasks to override
the chosen servlet container. For example, if you define: gretty.servletContainer = 'jetty9'
and
run task tomcatRun
, your web-app will actually run on tomcat.