<value>Maven m2Release (java:20.1-b02-383 ${env.BUILD_TAG }</value>
</property>
</httpHeaders>
</configuration>
</server>
10.7.2. Copying Artifacts
During a build process involving several build jobs, such as the one illustrated in Figure 10.33, “A more
complicated build job dependency graph”, it can sometimes be useful to reuse artifacts produced by one
build job in a subsequent build job. For example, you may want to run a series of web tests in parallel
on separate machines, using local application servers for improved performance. In this case, it makes
sense to retrieve the exact binary artifact that was produced in the previous build, rather than rebuilding
it each time or, if you are using Maven, relying on a SNAPSHOT build deployed to your enterprise
repository. Indeed, both these approaches may run the risk of inconsistent build results: if you use a
SNAPSHOT from the enterprise repository, for example, you will be using the latest SNAPSHOT build,
which may not necessarily be the one built in the upstream build job.
The Copy Artifact plugin lets you copy artifacts from an upstream build and reuse them in your current
build. Once you have installed this plugin and restarted Jenkins, you will be able to add a new type of
build step called “Copy artifacts from another project” to your freestyle build jobs (see Figure 10.39,
“Adding a “Copy artifacts from another project” build step”).
Figure 10.39. Adding a “Copy artifacts from another project” build step
This new build step lets you copy artifacts from another project into the workspace of the current project.
You can specify any other project, though most typically it will be one of the upstream build jobs. And
of course you can specify, with a great deal of flexibility and precision, the exact artifacts that you want
to copy.
You need to specify where to find the files you want in the other build job’s workspace, and where
Jenkins should put them in your current project’s workspace. This can be a flexible regular expression