简体   繁体   English

将Webapp添加到tomcat服务器时的m2e默认生命周期

[英]m2e default lifecycle when adding webapp to tomcat server

I'm using m2eclipse for a while, and I suddenly ask myself this very basic question: 我使用了m2eclipse一段时间,然后突然问自己这个非常基本的问题:

Which maven phases are part of the lifecycle when I drag and drop a webapp into my tomcat server? 将Webapp拖放到tomcat服务器中时,生命周期的哪些阶段是?

I assume it must be something like "clean package" PLUS a deployment of the package into the tomcat webapp directory. 我认为它必须类似于“干净的程序包”,再加上将程序包部署到tomcat webapp目录中。 But I can't find an article defining it precisely. 但是我找不到精确定义它的文章。 Also, is this default behaviour overridable? 此外,此默认行为是否可以覆盖?

Am I totaly wrong? 我完全错了吗?

Thanks in advance! 提前致谢!

You're right - you will typicaly go through (regardless of whether you use the m2eclipse or the commandline version) 您是对的-通常,您都会经历(不管您使用的是m2eclipse还是命令行版本)

  • the clean lifeycle (refer to the standard phases in this lifecycle here ) clean lifeycle(参考标准阶段在此生命周期这里

  • the default lifeycle, particularly the phases from validate thru package (again, refer to the standard phases in this lifecycle here ) default lifeycle,特别是从相位validatepackage (再次,参考标准相在此生命周期这里

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 ). 对于默认生命周期,这些绑定取决于包装值( 在您的情况下应为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. 因此, maven-war-plugin为您处理要部署的包装(不要与Maven deploy混淆),以适合您的情况。

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. 尽管您通常希望将其install到本地m2存储库中,然后deploydeploy到远程m2存储库中,以使工件( *.war )在本地环境以外的环境中可用。 For that, you will want to go further into the default lifecycle depending on your need. 为此,您将根据需要进一步进入default生命周期。


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. 另外, tomcat7-maven-plugin可以帮助您在任何tomcat服务器上部署工件,您只需要将正确的目标附加到适当的阶段即可。 Read more about the use of the plugin here . 此处阅读有关插件使用的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM