Copying an artifact from another build job
n this recipe, we will copy artifact/file/package from one build to other. It helps in the deployment or copy operations. Even with Master/Agent architecture, we can copy artifacts effortlessly using the Copy Artifact
Plugin.
Getting ready
You need to allow read access to anonymous users, as the Copyartifact
plugin treats builds running as an anonymous. To allow read access to anonymous, do the following:
Go to Manage Jenkins
| Global Security Configuration
:

Click on Save
.
How to do it...
- Go to Jenkins dashboard |
Project
|Configure
|Build
|Add build step
|Copy artifacts from another project
. - Give the
Project name
from which you want to copy the artifact. - For the
Which
field, select appropriate options from the available list:

- Provide the name of the
Artifacts to copy
:

- Click on
Save
.
There's more...
- You can also specify projects that can copy artifacts.
- For example, in the
PetClinic-Package
project you can create a WAR file that you can deploy to the application...