bit-question
bit-question

Reputation: 3843

question on mvn -e clean install

In maven, what does "-e" stands for in the following command.

mvn -e clean install

Moreover, what is the difference between

mvn clean install  

and

mvn clean compile

Upvotes: 9

Views: 24325

Answers (3)

Kasun Gajasinghe
Kasun Gajasinghe

Reputation: 2776

mvn clean install - First, cleans already compiled class files (probably in target/ directory). Then, it compiles the classes, generate the jar, and then install the created jar to your local m2 repository (probably located at ~/.m2/repository/).

mvn clean compile - The clean does the same thing as above. And, then, it compiles the java files in the project. And, stops there. It doesn't create the jar nor install anything to the local maven repository.

-e switch will display the stack-traces occur when your build is failed. It's a normal stack-trace that java programs produce when exceptions occur. Do note that Maven itself is a Java program.

Upvotes: 2

DuckPuppy
DuckPuppy

Reputation: 1366

As Satish stated, the "-e" switch will display execution errors in the maven output.

As to the difference in "install" vs "compile", those are different Maven lifecycle stages. See the Introduction to the Build Lifecycle documentation for help with that. The key to remember is that Maven will execute all lifecycle stages up to and including the one you specify, and then stop.

Specifically in your case, "mvn clean compile" will run Maven with two lifecycle targets, the first being "clean", and the second being "compile". The "compile" lifecycle phase will run the build up to and including the compilation of project source code. The "install" lifecycle phase will run all the way through packaging your project into it's container (jar, war, etc) and will install it to your local maven repository, which resides on your local machine. When a project is installed to your local repository, other projects you build on your machine can reference it without having to have any knowledge of where the source code or project build artifacts actually reside.

Upvotes: 15

Satish
Satish

Reputation: 6485

the e flag (e = errors) prints out more detailed error messages. mvn clean install, does compilation, linking and installs (copies to app server etc)

for more maven options look at this ref card http://www.scribd.com/doc/15778516/DZone-Refcard-55-Apache-Maven-2

or maven command list http://cvs.peopleware.be/training/maven/maven2/mvnCommand.html

Upvotes: 2

Related Questions