m2e default lifecycle when adding webapp to tomcat server

若如初见. 提交于 2019-12-12 06:14:38

问题


I'm using m2eclipse for a while, and I suddenly ask myself this very basic question:

Which maven phases are part of the lifecycle when I drag and drop a webapp into my tomcat server?

I assume it must be something like "clean package" PLUS a deployment of the package into the tomcat webapp directory. But I can't find an article defining it precisely. Also, is this default behaviour overridable?

Am I totaly wrong?

Thanks in advance!


回答1:


You're right - you will typicaly go through (regardless of whether you use the m2eclipse or the commandline version)

  • the clean lifeycle (refer to the standard phases in this lifecycle here)

  • the default lifeycle, particularly the phases from validate thru package (again, refer to the standard phases in this lifecycle here)

by running

mvn clean package

Quoting the doc further (emphasis mine),

Some phases have goals bound to them by default. And for the default lifecycle, these bindings depend on the packaging value (which in your case should be war).

So the maven-war-plugin handles the packaging for you to deploy (not to be confused with the Maven deploy) it to a tomcat instance in your case.

Although you will usually want to install it to your local m2 repository and deploy it to a remote m2 repository for the artifact (*.war) to be available in environments other than your local. For that, you will want to go further into the default lifecycle depending on your need.


Also, the tomcat7-maven-plugin can help you deploy the artifact on any tomcat server, you will just need to attach the right goal to the appropriate phase. Read more about the use of the plugin here.



来源:https://stackoverflow.com/questions/30403197/m2e-default-lifecycle-when-adding-webapp-to-tomcat-server

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