Normally, the maven-jetty-plugin should be configured in the pom of your Maven webapp project/module. But the project i am working is a legacy Java project with many modules and the webapp module depends on others. so i cannot simply start it due to the build sequence.
What i am going to do is to add an new Maven module for integration test of the Maven webapp module and it would be build in the last module such that all other modules are ready.
Assume you got a parent project with 2 child Maven modules.
1. Webapp module (Module Name: sibling_webapp)
2. Integration Test module
So you can configure a maven-jetty-plugin in the Integration Test module as follow
... <!-- maven-jetty-plugin configuration --> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.1.21</version> <configuration> <contextPath>/sibling_webapp</contextPath> <webAppSourceDirectory>${project.parent.basedir}/sibling_webapp/src/main/webapp</webAppSourceDirectory> <webXml>${project.parent.basedir}/sibling_webapp/src/main/webapp/WEB-INF/web.xml</webXml> <classesDirectory>${project.parent.basedir}/sibling_webapp/target/classes</classesDirectory> ... </configuration> </plugin> ...
You can start the sibling_webapp under the Integration Test module now using the mvn jetty:run command.
Done =)