0

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

SteveMc
  • 1,386
  • 8
  • 11

1 Answers1

0

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 e.g. in this thread.

Community
  • 1
  • 1
FrVaBe
  • 47,963
  • 16
  • 124
  • 157
  • According to the Jenkins log, the .war file gets built as target/artifactId.war (without the version). The only versioned resource is a .tar.gz inside target/assembly. This might be a result of an oddity in our pom.xml. – SteveMc Feb 13 '12 at 22:13
  • Changing our .war file is going to be best, I think. Thanks! – SteveMc Feb 13 '12 at 22:59
  • @SteveMc Be careful in changing your war name. It might affect your application URL after deploying it into a container. – FrVaBe Feb 14 '12 at 07:47
  • Thanks - we'll rename it before it gets deployed to a container; we never want more than one version running in a container. – SteveMc Feb 14 '12 at 15:23