question on mvn -e clean install

一笑奈何 提交于 2019-12-22 04:12:40

问题


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

回答1:


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.




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/6033459/question-on-mvn-e-clean-install

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!