Reputation: 9063
I have a maven webapp, which can be run using jetty. If I call jetty with
mvn jetty:run
it is executed before the install phase. However, I want to run jetty at the very end of the maven lifecycle only. How can I achieve that?
Or to put it in a different way. The run goal of jetty maven plugin is bound by default to a certain maven phase. Can I change that binding?
Update: Just to make sure, I don't want to know how to execute jetty automatically each time a maven phase is executed like pre-integration-test. I just want to bind the jetty run goal to a later phase so that additional maven phases get executed when calling it manually.
Upvotes: 1
Views: 1943
Reputation: 17983
That's not possible (using predefined packagings like jar
or war
). In Maven you run plugin's goal or phase (which starts lifecycle). If you run goal, only this goal is executed. If you run phase, lifecycle runs from the beginning to that phase included. Try to run (after mvn clean
) mvn install:install
(goal only) and then mvn install
(default lifecycle to the install
phase included).
You can create own plugins' goals to lifecycle's phases binding by creating own packaging type. Predefined packaging types (jar
, war
, ear
, etc.) have this binding already specified.
Upvotes: 1