Details
-
Type:
Improvement
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 6.1.15.pre0
-
Component/s: Maven
-
Labels:None
-
Number of attachments :
Description
According to http://jetty.mortbay.org/jetty/maven-plugin/run-war-mojo.html one can specify any WAR file to be deployed in Jetty using the webApp parameter to the run-war goal.
However, it also states:
"This goal is used to assemble your webapp into a war and automatically deploy it to Jetty."
It seems that there's currently no way to prevent it from forking a build lifecycle that tries to make the WAR out of the current artifact.
There are situations where this is undesirable.
For example, suppose we have a HTTP client application and we want to unit test it against a real life webapp deployed on a real server.
Similarly to the integration testing scenario, described on http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin, we could use jetty-maven-plugin for this task, by binding execution of the "run-war" goal e.g. to the "process-test-classes" phase and the "stop" goal to "test" phase (it should run after the actual tests). Jetty would run in daemon mode using a prebuild WAR file (e.g. placed in the testResources directory).
The problem is that currently Jetty invokes a forked build of the current artifact (intended to assemble a WAR), and that build runs the unit tests, and Jetty run-war only starts afterwards, when the tests (requiring Jetty) have already failed.
It should be possible to completely prevent forking that WAR assembling build. Maybe an optional goal parameter, like "assembleWar", defaulting to "true".
OK, I've checked that this seems to be impossible without creating a separate goal, as the forked lifecycles are hardcoded in generated plugin.xml (the <executePhase> element, generated from the "@execute phase=PHASE_NAME" annotation on the corresponding Mojo class).
The Jetty6RunWar class (http://www.mortbay.org/jetty/jetty-7/xref/org/mortbay/jetty/plugin/Jetty6RunWar.html) has @execute phase="package".
So I've made a simple test by making a copy of the whole class, named Jetty6RunWarNoFork, with only slightly changed annotations and building jetty-maven-plugin: