jettyStartWar starts web-app on WAR-file.


gradle jettyStartWar


  1. The web-app gets compiled and assembled into WAR-file (if it’s not up-to-date).

  2. Embedded servlet-container starts in separate java process against WAR-file and listens for HTTP-requests on port (default 8080).

  3. Gretty waits for servlet-container process to complete.

  4. Gradle script continues normal execution of tasks.

Note that this task does not stop Jetty. It is assumed that another gradle process stops it, supposedly gradle jettyStop.

Instantiation and extension

The object called jettyStartWar is actually an instance of JettyStartTask class, created and configured for you by Gretty. You can instantiate or even extend this class on your own:

apply plugin: 'org.akhikhl.gretty'

import org.akhikhl.gretty.JettyStartTask

task('MyRun', type: JettyStartTask) {
  // ...

class VerySpecialRun extends JettyStartTask {
  // ...

task('MyRun2', type: VerySpecialRun) {
  // ...

If you are going to instantiate or extend this task class yourself, make sure you’ve learned it’s properties and methods.