Differences Between mvn install and mvn verify

JavaMavenCommand Line

Java Problem Overview


What are the differences between Maven's mvn install and mvn verify commands?

How does the keyword clean modify these commands?

Java Solutions


Solution 1 - Java

mvn verify - as said before - performs any integration tests that maven finds in the project.

mvn install implicitly runs mvn verify and then copies the resulting artifact into your local maven repository which you usually can find under C:\Users\username\.m2\repository if you are using windows.

If you run maven multiple times without the clean command and without changing any source code, you may notice that it says Nothing to compile - all classes are up to date during the compile phase. If you add the clean command before any other command, maven will simply delete the entire target directory resulting in all classes being recompiled.

Solution 2 - Java

From https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html:

mvn install - install the package into the local repository, for use as a dependency in other projects locally

mvn verify - run any checks on results of integration tests to ensure quality criteria are met

clean is a lifecycle that handles project cleaning. Commands involving clean before it will clear the entire directory, meaning that all the classes have to be recompiled.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNicholasView Question on Stackoverflow
Solution 1 - JavavatbubView Answer on Stackoverflow
Solution 2 - JavaṂųỻịgǻňạcểơửṩView Answer on Stackoverflow