简体   繁体   English

如何使用Eclipse内部的商品启动来启动/停止/重新部署Maven Web应用

[英]How to start/stop/redeploy maven web app using cargo start inside Eclipse

I have Maven2 war project built, I'm using the cargo start plugin, and it works great for deploying the web app. 我已经构建了Maven2 war项目,我正在使用cargo start插件,它非常适合部署Web应用程序。 To run the maven command, I use a .bat file in my workspace, and I have en external run config to run the the bat file. 要运行maven命令,我在工作区中使用一个.bat文件,并且已在外部运行配置文件中运行bat文件。 I can't seem to stop the server from the Eclipse console, or re-deploy. 我似乎无法从Eclipse控制台停止服务器或重新部署。

Does anyone have any advice on how quickly start/stop/re-deploy to Tomcat locally while developing. 在开发过程中,是否有人对在本地快速启动/停止/重新部署Tomcat有任何建议?

Did you try JavaEE tools and m2eclipse? 您尝试过JavaEE工具和m2eclipse吗? As far as I can see it should work well in most common situations. 据我所知,它应该在大多数常见情况下都能正常工作。 What m2eclipse does for you is to exactly map the maven configuration to an eclipse projects with the necessary facets set. m2eclipse为您提供的功能是将maven配置准确映射到具有必需构面的eclipse项目。 Also, if the Dynamic Web Application facet is set for your project, you will be able to deploy it to a Tomcat server that you set up in the Server view of JavaEE tools. 另外,如果为项目设置了Dynamic Web Application构面,则可以将其部署到在JavaEE工具的“服务器”视图中设置的Tomcat服务器。 This configuration allows hot redeploy. 此配置允许热重新部署。

More information on JavaEE tools: http://eclipse.org/home/categories/index.php?category=enterprise 有关JavaEE工具的更多信息: http ://eclipse.org/home/categories/index.php?category=enterprise

There is a full Eclipse distribution with the EE tools available on their download site: http://www.eclipse.org/downloads/ 可以在其下载站点上找到完整的Eclipse版本,其中包含EE工具: http//www.eclipse.org/downloads/

m2eclipse is freely available from Sonatype: http://m2eclipse.sonatype.org/ m2eclipse可从Sonatype免费获得: http//m2eclipse.sonatype.org/

At work we use the mentioned software as well. 在工作中,我们也使用上述软件。 Additionally we use the JBoss tools that provide a feature called Project Archives that let you individually build your web application archive (ear/war/...). 另外,我们使用JBoss工具提供了一个称为Project Archives的功能,该功能使您可以分别构建Web应用程序存档(ear / war / ...)。

To get startet you should perhaps start a fresh workspace and import the existing maven project (via the import existing maven project wizard). 要开始学习,您可能应该启动一个新的工作区并导入现有的maven项目(通过导入现有的maven项目向导)。 If everything went fine you can set up your tomcat in the server view. 如果一切正常,则可以在服务器视图中设置您的tomcat。 Maybe switch to the Java EE perspective. 也许切换到Java EE透视图。 Right click on the newly added server and select Add to add the dynamic web project you just imported. 右键单击新添加的服务器,然后选择添加以添加刚导入的动态Web项目。 If it doesn't show up in the list try to update the project configuration via the project's maven context menu. 如果未在列表中显示,请尝试通过项目的Maven上下文菜单更新项目配置。

Well, you could use cargo:redeploy to Undeploy and deploy again a deployable (that's a shortcut to cargo:deployer-redeploy ). 好了,您可以使用cargo:redeploy取消部署,然后再次部署可部署项 (这是cargo:deployer-redeploy的快捷方式)。 But I personally don't use Cargo this way, I use it mostly for integration testing (ie during the build) and use Eclipse WTP during development (this works whether you're using the maven eclipse plugin or m2eclipse). 但是我个人不是这样使用Cargo,而是将其主要用于集成测试(即,在构建过程中),而在开发过程中则使用Eclipse WTP(无论您使用的是maven eclipse插件还是m2eclipse,这都可以使用)。

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

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