This seems to be dated. Check out Maven jetty plugin which will use the (when written) 6.1.x jetty plugin.
Using the Maven Jetty6 plugin
This note is to describe the above plugin, which will run your web application in an embedded Jetty6 instance by just
typing "mvn jetty6:run"
- No need to download or install Jetty manually, it's all automatic once the Maven project
descriptor's set up (the pom.xml)
Configuring the pom.xml
Currently, the best plugin version to use is the 6.0-SNAPSHOT one, so be aware that it is a little out on the edge. The reason for this is that earlier versions of Jetty used commons-logging, which lead to various class-loader issues, e.g. org.apache.commons.logging.LogConfigurationException: No suitable Log constructor...</tt><br>
Thankfully, the lastest version of the plugin/Jetty6 has switched to SLF4J so they've disappeared, but that version of plugin/Jetty6's not yet been released...
Add the following to your project pom.xml
at the same level as the <build>
or <dependancies>
blocks.
{panel} <pluginRepositories> <pluginRepository> <id>mortbay-repo</id> <name>mortbay-repo</name> <url>http://www.mortbay.org/maven2/snapshot</url> </pluginRepository> </pluginRepositories> {panel}
then add the following to your <build><plugins>
block.
{panel} <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty6-plugin</artifactId> <version>6.0-SNAPSHOT</version> <configuration> <webAppSourceDirectory>src/webapp</webAppSourceDirectory> <scanIntervalSeconds>10</scanIntervalSeconds> </configuration> </plugin> {panel}
The <configuration>
entries are optional but shown here as examples. The first shows how the WebApp folder may be
passed to the plugin is it's not the default src/main/webapp, while the second is the pause in seconds between sweeps of the webapp to check for changes. It will automatically hot redeploy if any are detected - by default this is 0, which disables hot deployment scanning.
Note that even if this is not enabled, the Wicket "development" application settings will still be monitoring for markup changes.
For more details on the Jetty6 plugin, see here<br>
For an example of this, see the Wicket Phonebook example, although this is only in the pom.xml in CVS HEAD there at the moment.
Running
To run, just invoke with a mvn jetty6:run
and let it do it's thing - the first time, it'll download various jars but shortly you should have your web-app compiled & running in a local Jetty instance, listening on http://localhost:8080/
Scanning
I've not done much with this, but when scanning's enabled, if a change is made to the sources and a 'mvn compile' is run from a second process, the Jetty instance will detect the changes & redeploy the application. I've not yet had a chance to see how this compares to using an HotSwapping from within an IDE though, but it might prove useful in some circumstances. I'm slightly surprised that it doesn't monitor the source & itself trigger off a compile when changes are seen, but I could well be missing something here...
Gwyn 09:44, 10 Mar 2006 (GMT)