Maven 2 Jetty plugin

This plugin is for running a web application directly from Maven.

It currently support running the generated war file as a web application in Jetty, with the run-war goal. This goal will execute the package phase and then run Jetty with the generated war as a web application. By default, Jetty will run on port 8080, with the context path set to app/ and the location of the war file set to $project.build.directory/$project.build.finalName.war. You can alternatively specify your own properties or create a Jetty xml configuration file.

Available Configuration Options

ParameterOptionalDefaultDescription
portOptional8080
contextPathSpecOptional/appThe context path
webAppOptional$project.build.directory/$project.build.finalName.warThe location of the war file
jettyConfigOptionalThe location of a Jetty xml configuration file,
it will override all other parameters

Using the plugin

Add the plugin to your POM's plugin configuration:

<project>
  ...
  <build>
    ...
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>
</project>

You can configure your plugin with the optional parameters, by following the instructions found in the Getting Started Guide.

Then run m2 with one of the available goals:

m2 jetty:run-war

Point you browser to http://localhost:<port>/<contextPathSpec>/