Java EE 战争部署或重新部署 - 自动选择适当的操作
在开发过程中,想要将 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
cargo:redeploy
现在在 Cargo 1.1.3 中按预期工作(至少对于 glassfish)cargo:redeploy
now works as expected in cargo 1.1.3 (at least with glassfish)并不是您问题的真正答案,但作为一种解决方法,您可以使用
如果我没记错的话,如果应用程序未部署,则cargo:undeploy目标不会失败,并且maven将继续使用cargo:deploy目标。
Not really an answer to your question, but as a workaround you can use
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.