将 m2eclipse 的 War-Plugin 集成到 Eclipse 项目中
我使用 JSF 和 Maven 建立了一个小型 Web 项目。现在我想部署在Tomcat服务器上。是否有可能像 Eclipse 中的按钮一样自动将项目部署到 Tomcat?
我读到了 Maven War 插件 但我找不到教程如何将其集成到我的流程中(eclipse/m2eclipse)。
您可以链接我来帮助或尝试解释一下吗?谢谢。
I set up a small web project with JSF and Maven. Now I want to deploy on a Tomcat server. Is there a possibility to automate that like a button in Eclipse that automatically deploys the project to Tomcat?
I read about a the Maven War Plugin but I couldn't find a tutorial how to integrate that into my process (eclipse/m2eclipse).
Can you link me to help or try to explain it. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在开发过程中,我建议使用 Eclipse Web Tools Platform (WTP)。 M2Eclipse 提供了对它的支持(假设您安装了 Maven Integration for WTP)和您的项目应被识别为可在服务器上运行的动态 Web 项目。
因此,将 Tomcat 声明为服务器(显示服务器视图并在其中右键单击,通过新建>添加服务器)服务器)。并将您的项目部署到其中(右键单击您的项目,然后运行 > 在服务器上运行)。
还有其他选项,例如使用
Tomcat Maven 插件
或通用Cargo Maven Plugin
但我不会使用它们对于开发来说,由于你是 Maven 初学者,我根本不推荐它们。使用您的 IDE。实际上,Maven War Plugin 只负责 webapp 项目的打包(当使用
war
时,它会在package
阶段自动绑定)为您的项目)。它不用于部署。但正如我所说,在开发过程中使用 IDE 来部署应用程序。During development I recommend to use Eclipse Web Tools Platform (WTP). M2Eclipse provides support for it (assuming you have Maven Integration for WTP installed) and your project should be recognized as a Dynamic Web Project runnable on a Server.
So, declare Tomcat as a Server (show the Servers view and right-click in it to add a Server via New > Server). And deploy your project to it (right-click on your project then Run > Run on Server).
There are other options like using the
Tomcat Maven Plugin
or the genericCargo Maven Plugin
but I wouldn't use them for development and, since you are a Maven beginner, I don't recommend them at all. Use your IDE.Actually, the Maven War Plugin is only responsible of the packaging of your webapp project (it is bound automatically on the
package
phase when using a<packaging>war<packaging>
for your project). It isn't used for deployment. But as I said, use your IDE to deploy your application during development.war 插件用于生成 war 文件,而不是部署它们。您所要求的内容可能由Cargo 插件提供。另一个有趣的候选者可能是 jetty-maven-plugin。
The war plugin is for generating war files, not for deploying them. What you are asking for may be provided by the Cargo Plugin. Another interesting candidate for you could be the jetty-maven-plugin.