gretty {
port = 8081
contextPath = '/MyWebApp'
// ... many more properties
}
When you apply gretty plugin, it adds gretty extension to the project. You can (but you don’t have to) customize every aspect of gretty plugin with the help of gretty DSL:
gretty {
port = 8081
contextPath = '/MyWebApp'
// ... many more properties
}
All gretty tasks, when invoked on given project, use properties of gretty extension.
If you don’t specify any properties in gretty extension (or omit it altogether), gretty tasks run with reasonable defaults.
Gretty extension supports the following server-specific properties:
Property | Type | Default | Purpose |
---|---|---|---|
List<String> |
[] |
Additional JVM arguments to servlet-container process. |
|
String |
'jetty9' |
Servlet container to be used in appXXX tasks. Possible values are 'jetty7', 'jetty8', 'jetty9', 'jetty93' (jdk 8 only), 'jetty94' (jdk 8 only), 'tomcat7', 'tomcat8'. |
|
boolean |
false |
When true, Gretty gradle tasks facilitate your web-app with springloaded library, thus allowing to live-reload compiled classes and avoid restarting servlet container. |
|
String |
"localhost" |
host is passed to servlet-container connectors. If you use HTTPS, host must match CN of the subject DN of the certificate (if you use HTTP auto-configuration, Gretty ensures this automatically). |
|
boolean |
true |
When httpEnabled is true, Gretty configures HTTP connector for the designated httpPort. Otherwise HTTP protocol is disabled. Normally either httpEnabled or httpsEnabled should be true. |
|
int |
8080 |
TCP-port used by servlet-container for incoming HTTP-requests. |
|
int |
8080 |
This property is deprecated, please use httpPort instead |
|
int |
null |
When not null, defines the time, in milliseconds, that the HTTP connection can be idle before it is closed. |
|
boolean |
false |
When httpsEnabled is true, Gretty configures HTTPS connector for the designated httpsPort. Otherwise HTTPS protocol is disabled. Normally either httpEnabled or httpsEnabled should be true. |
|
int |
8443 |
TCP-port used by servlet-container for incoming HTTPS-requests. |
|
String or java.io.File |
null |
Absolute or relative path to the key-store, containing key and certificate for HTTPS connection. If sslKeyStorePath is not specified, all other SSL-related properties are ignored and HTTPS is auto-configured (if it is enabled). |
|
String |
null |
Password for the key-store designated by property sslKeyStorePath. |
|
String |
sslKeyStorePassword |
Password for the key of this host, stored in key-store designated by property sslKeyStorePath. |
|
String or java.io.File |
sslKeyStorePath |
Absolute or relative path to the trust-store for HTTPS connection. |
|
String |
null |
Password for the key-store designated by property sslKeyStorePath. |
|
boolean |
false |
Specify if client auth is required |
|
int |
null |
When not null, defines the time, in milliseconds, that the HTTPS connection can be idle before it is closed. |
|
String or java.io.File |
"jetty.xml" or "tomcat.xml" |
Name and/or location of servlet-container-specific server configuration file. |
|
String or java.io.File |
"jetty.xml" |
This property is deprecated, please use serverConfigFile instead. |
|
int |
1 |
Hot-deployment scan interval, in seconds. |
|
String |
"logback.groovy" or "logback.xml" |
Absolute or relative path to logback configuration file (.groovy or .xml). |
|
String |
"INFO" |
slf4j logging-level for servlet-container process. |
|
boolean |
true |
Defines whether log messages are written to the terminal. |
|
boolean |
true |
Defines, whether log messages are written to the log-file. |
|
String |
"${project.name}.log" |
Log file name (without path). |
|
String |
"${user.home}/logs" |
Directory, where the log file is created. |
|
function(Closure) |
- |
Adds closure to be called just before servlet-container is started. |
|
function(Closure) |
- |
Adds closure to be called just after servlet-container is stopped. |
|
function(Closure) |
- |
Adds closure to be called on hot-deployment scan. |
|
function(Closure) |
- |
Adds closure to be called whenever hot-deployment detects that files or folders were changed. |
|
int |
9900 |
TCP-port used by Gretty to send commands to servlet-container process. |
|
int |
9901 |
TCP-port used by servlet-container process to send status back to Gretty. |
|
String |
stopOnKeyPress |
Defines Gretty’s reaction on user keypress. When 'stopOnKeyPress', any keypress stops running web-server. When 'restartOnKeyPress', any keypress causes web-server restart. When 'rebuildAndRestartOnKeyPress', any keypress causes Gretty to rebuild web-apps and then restart web-server. |
|
String |
1.1.7.RELEASE |
Defines which version of SpringBoot must be used with the given web-server/web-app. |
|
boolean |
false |
When true, Tomcat supports JNDI resource naming. |
|
String |
restart |
Defines Gretty behaviour on application redeployment. When 'restart' gretty simply restarts servlet container. When 'redeploy' gretty redeploys web application on servlet container. Redeploy is useful when multiple application is started in farm mode. |
|
String |
jetty |
Switch between jetty and jdk scanners. 'jetty' is scan-based and 'jdk' is notify-based (jdk 7). |
|
List<Integer> |
null |
If specified gretty will pick service and status port from it. |
|
String |
gretty_port.properties |
Specifies name of file for gretty service and status port. |
Gretty extension supports the following web-app-specific properties:
Property | Type | Default | Purpose |
---|---|---|---|
String |
"/${project.name}" |
Context path for the web-app. |
|
[[__beforeclasspath] beforeClassPath |
function(URL… url) |
- |
Adds classpath entry before web-app classpath |
function(URL url) |
- |
Add classpath entry to the web-app. |
|
function(String key, String value) |
- |
Adds web-app initialization parameter. |
|
String or java.io.File |
"jetty-env.xml" or "tomcat-context.xml" |
Name and/or location of servlet-container-specific context configuration file. |
|
String or java.io.File |
"jetty-env.xml" |
This property is deprecated, please use contextConfigFile instead. |
|
String |
null |
Security realm for the given web-app. |
|
String or java.io.File |
"jetty-realm.properties" or "tomcat-users.xml" |
Contains security realm properties for the given web-app. |
|
function(String) or function(java.io.File) |
- |
Adds a directory to the list of directories scanned by hot-deployment. |
|
boolean or function(String) or function(java.io.File) or function(Map) |
true |
Adds folders to be fast-reloaded on change, i.e. copied to running web-app without restarting web-app. |
|
boolean |
true |
Should the given web-app automatically recompile on source change? |
|
boolean |
true |
Should the given web-app automatically reload when it’s compiled classes change? |
|
boolean |
true |
Should the given web-app automatically reload when configuration files (either in WEB-INF or META-INF) change? |
|
boolean |
true |
Should the given web-app automatically reload when library files (either in WEB-INF/lib or in maven dependencies) change? |
|
String |
"soft" |
Can be "soft" or "hard" (default "soft"). When "hard", the web-server serves the resources (of the given web-app) directly
from src/main/webapp. When "soft", the web-server serves the resources (of the given web-app) from build/inplaceWebapp. |
|
function(String) or function(Project) |
- |
Adds another project (in the same project tree) as overlay source. |
|
String |
"integrationTest" |
Name of gradle task in the same project, which gretty "encloses" with servlet-container start/stop. |