简体   繁体   中英

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. I then need to copy the deployed .war to an external location. 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). Is there a way to get it, or a way to do this that's more integrated into maven? I can calculate the deployment path using Jenkins build parameters but it seems like a hack.

Thanks, Steve

After a maven build you should always find the build artifact at

target/<artifactId>-<version>.<packaging>

You can access this path within the maven pom.xml by using the maven properties (see pom reference )

${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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM