I have some third-party jar dependency. So, I have used maven-install-plugin to install these third party jar to my local repository(.m2/repository). This plugin is bound to clean phase. When i do "mvn clean install", before running clean , its starts searching for dependency and ultimately the build fails since it fails to find third party jar. But when i run mvn clean separately , it installs the file in local repository. Subsequently when i run mvn clean install, which builds successfully. Is mvn clean + mvn install != mvn clean install ?
Asked
Active
Viewed 1,402 times
1 Answers
2
Maven defined 3 independent build lifecycles: build, clean, and site.
mvn clean install
runs 2 of them.
mvn clean
and later mvn install
should run them one after the other.
It may take a bit more time to execute (since maven needs to start twice) - but the results should be the same.
Please note the validate
step happens only on the build
cycle - and not on the clean
cycle.

Lior Bar-On
- 10,784
- 5
- 34
- 46
-
All this is fine, but i fail to understand why mvn clean deosn't check for dependency but mvn clean install does(before running the clean itself) – Madhav Kumar Jha Jul 21 '18 at 14:57
-
This is likely to be due to the `validate` phase that exists only on the "build" flow - where "install" is a step. – Lior Bar-On Jul 22 '18 at 06:59