...
| Code Block |
|---|
|
<project>
...
<plugins>
...
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<configuration>
<webApp>${basedir}/target/mycustom.war</webApp>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>test-compile</phase>
<goals>
<goal>deploy-war</goal>
</goals>
<configuration>
<daemon>true</daemon>
<reload>manual</reload>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</project>
|
Running Multiple Webapps
Sometimes you need to deploy a number of webapps, not just the webapp under development. You can do this with the mvn jetty:run goal by supplying extra contextHandlers in the pom configuration.
Here's an example of setting up an extra webapp to run in the same jetty instance as the webapp under development:
| Code Block |
|---|
|
<project>
...
<plugins>
...
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<configuration>
<webApp>${basedir}/target/myfunkywebapp</webApp>
<contextHandlers>
<contextHandler implementation="org.mortbay.jetty.webapp.WebAppContext">
<war>${basedir}../../myother.war</war>
<contextPath>/other</contextPath>
</contextHandler>
</contextHandlers>
</configuration>
</plugin>
</plugins>
</project>
|
This would deploy both the webapp under development - unassembled - at the context path "/" and a second webapp at the contex path "/other".
Setting System Properties
...