Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Maven Build and Maven install

Tags:

I'm using Maven in Eclipse and when I try to build my project I see the following options:

  1. Build
  2. Clean
  3. generated-sources
  4. Install

What is the difference between the Build and install? If build can be configured to execute different goals like "install"...Why do we need separate items?

like image 334
user1050619 Avatar asked Sep 26 '14 01:09

user1050619


People also ask

What is difference between Maven install and Maven test?

mvn test-compile: Compiles the test source code. mvn test: Runs tests for the project. mvn package: Creates JAR or WAR file for the project to convert it into a distributable format. mvn install: Deploys the packaged JAR/ WAR file to the local repository.

What is Maven build?

Maven is a popular open-source build tool developed by the Apache Group to build, publish, and deploy several projects at once for better project management. The tool provides allows developers to build and document the lifecycle framework.

What is the difference between Maven clean and Maven install?

mvn clean install tells maven to do the clean phase in each module before running the install phase for each module. mvn clean is its own build lifecycle phase (which can be thought of as an action or task) in maven.

What is Maven install?

The Install Plugin is used during the install phase to add artifact(s) to the local repository. The Install Plugin uses the information in the POM (groupId, artifactId, version) to determine the proper location for the artifact within the local repository.


Video Answer


1 Answers

Maven - Introduction to the Build Lifecycle is something worth reading.

What follows the mvn command can be a build phase, or a plugin goal.

I would suggest that you know the use of different "goals", without going too deep.

  1. build: I have never seen such goal. Trying mvn build in my own project also gives me error.
  2. clean: cleans up the output targets
  3. generate-source: one phase of the default lifecycle. Running it will do all phases in the lifecycle, until generate-source. Hence, compile, packaging etc is not run.
  4. install: another phase of default lifecycle. It will compile, package your project, and then install it to your local repository. (I hope you have the concept of local and remote repository in Maven)
like image 78
Adrian Shum Avatar answered Sep 22 '22 04:09

Adrian Shum