It’s been a while since I used the Jetty Maven plugin. I really liked it, though, because it always allowed me to launch my service rapidly from the command line as a part of a build, without having to worry about starting/stopping a service, moving around jars and wars, etc.
Some people really like the Tomcat or Jetty integration right inside Eclipse, but I just never really took a liking to that.
I discovered yesterday, for the project that I’m on, that there’s a new version of the Jetty plugin for Maven. This setup goes into the <build><plugins> section of the pom. It doesn’t require any additional dependencies.
Note that I tied it to 7.0.0.pre5, but you can delete the <version> element altogether. However, if you delete it, then maven prints a warning.
To launch it, use:
Although I usually do a cleanup as a part of the launch:
mvn clean jetty:run
Then the base URL (note that I set the contextPath to / above) is:
The one snag I hit is that I had to go into my maven/conf settings.xml and add this element:
…I saw some other posts around the blog, and no one was sure why that was necessary. For some reason, the invocation of the jetty plugin was tripping over an org.apache jetty plugin.
For more documentation on the plug-in, see:
This version of the plug-in is a replacement for the 6.0 plugin.