在 Jenkins 构建后脚本中访问 Maven 构建属性以检索已部署的工件
我有一个 Jenkins 构建并部署到远程存储库的 Maven 项目。然后我需要将部署的 .war 复制到外部位置。我一直在尝试使用构建后 shell 脚本来执行此操作,但我没有看到任何从 Maven 获取构建信息的方法(例如,已部署工件的 URL)。有没有一种方法可以得到它,或者有一种方法可以更集成到 Maven 中?我可以使用 Jenkins 构建参数来计算部署路径,但这看起来像是一个 hack。
谢谢, 史蒂夫
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Maven 构建之后,您应该始终在以下位置找到构建工件:
您可以使用 maven pom.xml 中访问此路径.html#Properties" rel="nofollow noreferrer">属性(参见 pom 参考 >)
至构建后将工件复制到另一个位置,您可以使用此线程中描述的多种方法。
After a maven build you should always find the build artifact at
You can access this path within the maven
pom.xml
by using the maven properties (see pom reference)To copy the artifact to another location after the build you can use several approaches described e.g. in this thread.