Running

To start the local server with hot code reloading, run the task provided by the plugin:

gradle runWarlike

This task will start the server.

Live resources

The plugin configures the classpath so that src/main/resources (and whatever you put in sourceSets.main.resources.srcDirs) is available, and build/resources/main is not. That means you can edit your resources in src/main/resources and se the changes immediately, instead of having to rebuild the project to make your changes visible. This is particularly useful if you have things like javascripts and templates on the classpath.

Manually reloading server instance

NOT IMPLEMENTED YET

Hit the enter key in the terminal where you're running the server.

This is faster than restarting the entire Gradle process.

You need this when you make changes that hot code reloading doesn't affect, such as changing web.xml.

Reloading means shutting down the embedded WAR container server. Any servlets you have will have their shutdown hooks called. If you have global state, you're responsible for tearing that down yourself if you want to. The plugin doesn't provide any hooks. Global state is bad, m'kay! One recommendation is to create a spring-context that contains all your state, and avoid global state entirely. Ensure that all your stateful beans implement teardown hooks properly, and this method o

Configuring

You can configure the runWarlike task:

runWarlike {
port =1234
}

port

The port number to start the local web server at.

web.xml

This plugin follows the conventions of the "war" plugin. This is where you'll put web.xml:

src/main/webapp/WEB-INF/web.xml

Note that web.xml is not required. We implement Servlet 3.0 annotation based web listeners as well.

Todo

Make more stuff configurable. Perhaps the IP to bind to, now we just use Jetty defaults.