J Fabian Meier
J Fabian Meier

Reputation: 35795

Execute a Maven phase without the previous ones

Can I execute a Maven phase (say: deploy) without implicitly calling the previous ones?

The reason: I would like to construct something like install site-deploy (only-deploy) to make sure that the deployment of the artifact only happens if all other phases/goals were successful. I cannot replace (only-deploy) with deploy:deploy because some projects which use this configuration have additional goals in the deploy phase.

Upvotes: 7

Views: 2650

Answers (2)

Andreas Covidiot
Andreas Covidiot

Reputation: 4755

It's (now) possible:

To run a specific goal without executing its entire phase (and the preceding phases), we can use the command:

mvn <PLUGIN>:<GOAL>

For example, to run the integration-test goal from the Failsafe plugin, we need to run:

mvn failsafe:integration-test

another example: mvn compiler:compile

Upvotes: 2

Robert Scholte
Robert Scholte

Reputation: 12335

No, it is called lifecycle for a reason. When we start with the next major release of Maven, we'll work on advanced lifecycle handling, where https://issues.apache.org/jira/browse/MNG-5666 is part of the solution for your issue.

Both the install and deploy plugin have an experimental xxxAtEnd, maven-site-plugin deploy goal should require such option as well.

Upvotes: 6

Related Questions