Java EE 战争部署或重新部署 - 自动选择适当的操作

发布于 2024-12-02 20:22:14 字数 234 浏览 1 评论 0原文

在开发过程中,想要将 war 部署到本地应用程序服务器是相当常见的,无论它是否已经部署(即仅在旧版本上部署,如果存在)。

然而,cargo 和 glassfish maven 插件在以下情况下都会失败:

  • “重新部署”,如果 war 尚未部署,
  • “部署”,如果已经部署。

作为一名开发人员,我不想必须选择其中之一。是否有一个命令可以使部署在这两种用例中都成功?

In development, it's fairly common to want to deploy your war to your local app server, irrespective of whether it's already deployed (i.e. just deploy over the old version, if it's there).

However both cargo and the glassfish maven plugin fail under the following circumstances:

  • 'redeploy', if war is not already deployed,
  • 'deploy', if it's already deployed.

As a developer, I don't want to have to choose one or the other. Is there a single command that will enable deployment to succeed in both use cases?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

萝莉病 2024-12-09 20:22:14

cargo:redeploy 现在在 Cargo 1.1.3 中按预期工作(至少对于 glassfish)

cargo:redeploy now works as expected in cargo 1.1.3 (at least with glassfish)

土豪我们做朋友吧 2024-12-09 20:22:14

并不是您问题的真正答案,但作为一种解决方法,您可以使用

mvn cargo:undeploy cargo:deploy

如果我没记错的话,如果应用程序未部署,则cargo:undeploy目标不会失败,并且maven将继续使用cargo:deploy目标。

Not really an answer to your question, but as a workaround you can use

mvn cargo:undeploy cargo:deploy

If i recall correctly, the cargo:undeploy target won't fail if the application is not deployed and maven will proceed with the cargo:deploy target.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文