我已经构建了 Maven2 战争项目,我正在使用 cargo start 插件,它非常适合部署 Web 应用程序。要运行 maven 命令,我在工作区中使用 .bat 文件,并且我有外部运行配置来运行 bat 文件。我似乎无法从 Eclipse 控制台停止服务器,或重新部署。
有没有人对开发时在本地启动/停止/重新部署到 Tomcat 的速度有任何建议。
您尝试过 JavaEE 工具和 m2eclipse 吗?据我所知,它应该在大多数常见情况下都能正常工作。m2eclipse 为您做的是将 maven 配置准确映射到具有必要方面集的 eclipse 项目。此外,如果为您的项目设置了动态 Web 应用程序方面,您将能够将其部署到您在 JavaEE 工具的服务器视图中设置的 Tomcat 服务器。此配置允许热重新部署。
有关 JavaEE 工具的更多信息: http ://eclipse.org/home/categories/index.php?category=enterprise
在他们的下载站点上有一个完整的 Eclipse 发行版和 EE 工具:http: //www.eclipse.org/downloads/
m2eclipse 可从 Sonatype 免费获得:http: //m2eclipse.sonatype.org/
在工作中,我们也使用上述软件。此外,我们使用 JBoss 工具提供了一个名为 Project Archives 的功能,可让您单独构建 Web 应用程序存档 (ear/war/...)。
要开始,您也许应该开始一个新的工作区并导入现有的 Maven 项目(通过导入现有的 Maven 项目向导)。如果一切顺利,您可以在服务器视图中设置您的 tomcat。也许切换到 Java EE 视角。右键单击新添加的服务器并选择添加以添加刚刚导入的动态 Web 项目。如果它没有出现在列表中,请尝试通过项目的 Maven 上下文菜单更新项目配置。
Well, you could use cargo:redeploy
to Undeploy and deploy again a deployable (that's a shortcut to cargo:deployer-redeploy
). But I personally don't use Cargo this way, I use it mostly for integration testing (i.e. during the build) and use Eclipse WTP during development (this works whether you're using the maven eclipse plugin or m2eclipse).