Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between mvn:deploy and mvn:install commands?

I think there should be some differnce, but anyone can tell me the details?

like image 202
user705414 Avatar asked Sep 23 '11 15:09

user705414


People also ask

Does mvn deploy also install?

So, the answer is yes, mvn deploy will execute install and build the project artifacts.

What is Maven deploy?

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.

What is the difference between mvn install and mvn clean install?

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.

What is difference between Maven build and Maven install?

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.


4 Answers

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.

like image 92
Daniel Avatar answered Oct 27 '22 11:10

Daniel


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.

like image 26
Luca Geretti Avatar answered Oct 27 '22 09:10

Luca Geretti


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.

like image 23
Andrey Adamovich Avatar answered Oct 27 '22 09:10

Andrey Adamovich


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.

like image 33
mliebelt Avatar answered Oct 27 '22 11:10

mliebelt