5

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.

J Fabian Meier
  • 30,532
  • 9
  • 61
  • 119
  • Did you see this [answer](https://stackoverflow.com/a/5591268/8513835) and broader discussion on how to manage phases in multiproject setup through profiles [here](https://stackoverflow.com/questions/3147714/how-to-skip-install-phase-in-maven-build-if-i-already-have-this-version-installed) ? – Kostiantyn Sep 01 '17 at 13:01

2 Answers2

4

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.

Robert Scholte
  • 11,206
  • 2
  • 31
  • 42
  • Maven-site-plugin still has `skip` and `skipDeploy` parameters. Can they be utilized through configuring profiles to achieve finally the goal of not triggering deploy phase of mentioned 'projects with additional goals on deploy phase'? – Kostiantyn Sep 01 '17 at 13:09
-1

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

Andreas Covidiot
  • 3,888
  • 5
  • 45
  • 87