[英]Access Maven build properties in Jenkins post-build script to retrieve deployed artifact
I've got a Maven project that Jenkins builds and deploys to a remote repository. 我有一个Jenkins构建并部署到远程存储库的Maven项目。 I then need to copy the deployed .war to an external location.
然后,我需要将已部署的.war复制到外部位置。 I've been trying to do this with a post-build shell script but I don't see any way to get the build information from maven (for example, the URL of the deployed artifact).
我一直在尝试使用构建后的Shell脚本执行此操作,但是我看不到任何从maven获取构建信息的方法(例如,已部署工件的URL)。 Is there a way to get it, or a way to do this that's more integrated into maven?
有没有一种方法可以将它集成到Maven中呢? I can calculate the deployment path using Jenkins build parameters but it seems like a hack.
我可以使用Jenkins构建参数来计算部署路径,但这似乎很容易。
Thanks, Steve 谢谢,史蒂夫
After a maven build you should always find the build artifact at 在进行Maven构建之后,您应该始终在以下位置找到构建工件
target/<artifactId>-<version>.<packaging>
You can access this path within the maven pom.xml
by using the maven properties (see pom reference ) 您可以使用maven 属性在maven
pom.xml
访问此路径(请参阅pom参考 )
${project.build.directory}/${project.artifactId}-${project.version}.${project.packaging}
To copy the artifact to another location after the build you can use several approaches described eg in this thread . 为了在构建后将工件复制到另一个位置,您可以使用本线程中介绍的几种方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.