I think there should be some differnce, but anyone can tell me the details?
So, the answer is yes, mvn deploy will execute install and build the project artifacts.
The deploy plugin is primarily used during the deploy phase, to add your artifact(s) to a remote repository for sharing with other developers and projects. This is usually done in an integration or release environment.
clean is its own build lifecycle phase (which can be thought of as an action or task) in Maven. mvn clean install tells Maven to do the clean phase in each module before running the install phase for each module.
First of all, build is not a phase in the standard Maven lifecycles, whereas install is one. mvn install will invoke all the phases up to the phase install , which generally consists of compiling the source code, packaging the project and installing it in the local repository.
mvn:install
copies your packaged Maven module to your local repository (by default, in ~/.m2/repository
), to be accessed by other local Maven builds.
mvn:deploy
uploads your packaged Maven module to another (usually remote) repository, to be accessed by other, not necessarily local, Maven builds.
See the documentation for the build lifecycle for more info.
The install
phase is responsible for the installation of artifacts into local caching repositories. This basically applies to the Maven repository, but a well-known example is also the OSGi Bundle Repository supported by maven-bundle-plugin.
The deploy
phase is responsible for the installation of artifacts into published repositories. This usually applies to remote repositories, but is could perfectly be a local repository exposed to the outside world.
As all Maven phases, you can do with them anything you want. You can shuffle plugin phases as you see fit, but the above semantics is the conventional one and you should stick to it in order to be consistent with the default phases of other plugins' goals.
mvn:deploy
performs deployment to remote reposiory/environment, mvn:install
installs all compiled packages to a local repository making them available to other builds performed on the local machine.
In one sentence: mvn:install
compiles and installs your component in your local Maven repository, so that you can use it when other components used and developed locally depend on it. mvn:deploy
deploys your (previously installed) component to a remote repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With