Differences Between mvn install and mvn verify
Solution 1:
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:
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.