My maven
project packages a war
, which only gets deployed and is itself not a dependency to other projects (in other words is a final deployable).
Questions:
mvn install
on that package, which, in addition to mvn package
only puts it in the localRepository
?For a final deployable artifact indeed there may be no reason to invoke the install
phase instead of the package
phase: you want to build the .war
file and you don't need to install it in your local repository indeed.
However, you may want as an habit to always run integration tests, if any. Looking at the default Maven lifecycle these phases happen after the packaging:
package
take the compiled code and package it in its distributable format, such as a JAR.
pre-integration-test
perform actions required before integration tests are executed. This may involve things such as setting up the required environment.
integration-test
process and deploy the package if necessary into an environment where integration tests can be run.
post-integration-test
perform actions required after integration tests have been executed. This may including cleaning up the environment.
verify
run any checks to verify the package is valid and meets quality criteria.
install
install the package into the local repository, for use as a dependency in other projects locally.
Hence, by invoking install
you would make sure to always execute integration tests as well. Indeed a shorter invocation would be
mvn clean verify
Less popular but more effective in these cases.