Copy Artifact1.43.1Minimum Jenkins requirement: 2.121.1ID: copyartifact

Adds a build step to copy artifacts from another project.

The plugin lets you specify which build to copy artifacts from (e.g. the last successful/stable build, by build number, or by a build parameter). You can also control the copying process by filtering the files being copied, specifying a destination directory within the target project, etc. Click the help icon on each field to learn the details, such as selecting Maven or multiconfiguration projects or using build parameters. You can also copy from the workspace of the latest completed build of the source project, instead of its artifacts. All artifacts copied are automatically fingerprinted for you.


Pipeline syntax

Available since copyartifact-1.39

  • To copy artifacts from the latest stable build of "sourceproject"

    copyArtifacts(projectName: 'sourceproject');
  • To copy artifacts from the specific build of "downstream"

    def built = build('downstream');  //
    copyArtifacts(projectName: 'downstream', selector: specific("${built.number}"));
  • Parameters of copyArtifacts

    parameter type description



    the name of project (required)



    the selector to select the build to copy from. If not specified, latest stable build is used.



    comma-separated name and value pairs (name1=value1,name2=value2) to filter the build to copy from.



    ant-expression to filter artifacts to copy



    ant-expression to exclude artifacts to copy



    target directory to copy to



    ignore directory structures of artifacts



    do not fail the step even if no appropriate build is found.



    fingerprint artifacts to track builds using those artifacts. true for default



    useless for pipelines

  • selectors

    name feature


    Latest successful build


    Specific build


    Specified by permalink


    completed build (ignoring build status)


    Latest saved build (marked "keep forever")


    Specified by a build parameter


    Upstream build that triggered this job

Configuration Notes

  • When using this plugin with a Windows slave node that is configured as a Windows service, the service should have permission to interact with desktop (select "Allow service to interact with desktop" from Jenkins Slave service properties). Otherwise you may see errors similar to this:

    ERROR: Failed to copy artifacts from ...
    hudson.util.IOException2: java.lang.IllegalAccessError: class hudson.remoting.Pipe$ConnectCommand cannot
      access its superclass hudson.remoting.Command
    at hudson.FilePath.copyRecursiveTo(
    at hudson.FilePath.copyRecursiveTo(
    at hudson.plugins.copyartifact.FilePathCopyMethod.copyAll(

Recommended usage of Copyartifact

  • Artifacts should be stored as archived files.

    • Copyartifact tries to copy artifacts preserving file attributes like permissions and symbolic links. Though, it may fail in some situations (like for security issues).

    • It’s highly recommended to pack files to copy into an archive file, using tar command or zip pipeline step, especially when it’s important for you to preserving file attributes or directory structures.

Permissions to copy artifact

When you face a following message and fail to copy artifacts, this may be caused by permission to the project with artifacts. Please read this section once.

Unable to find project for artifact copy: YOUR_PROJECT_WITH_ARTIFACTS
This may be due to incorrect project name or permission settings; see help for project name in job configuration.
Build step 'Copy artifacts from another project' marked build as failure

Specifying project statically (without variables)

  • This case:

  • In this case, you can copy artifacts if you have permission to read the project to copy from at configuration time.

Specifying project dynamically (with variables)

  • Those cases:

  • If your Jenkins is secured, it fails to copy artifacts without a proper configuration.

  • You need to allow projects copy artifacts in one of following ways:

Allow read from anonymous

  • Copyartifact plugin treats builds running as an anonymous.

  • Copying artifacts is allowed if the project with artifacts is readable from anonymous.

  • When you use Matrix-based security for authorization, it can be done as following in Manage Jenkins > Global Security Configuration:

  • When you use Project-based Matrix Authorization Strategy for authorization, it can be done as following in the configuration page of the project to copy artifacts from:

Specify projects who can copy artifacts

  • Available since Copyartifact 1.30

  • In the project configuration pages, you can specify projects to allow copy artifacts from that project:

  • You can specify multiple projects with separating with commas.

  • You can use wildcard character ('*') to specify name patterns.

Since Copyartifact 1.30, there is a limitation "Permission to Copy Artifacts" accepts only relative project names.
If you use CloudBees Folders Plugin and the projects are located in different folders, you need to specify project names like "../folder/project".
This is fixed in Copyartifact 1.31.

Authorize builds as a user

  • Available since Jenkins 1.532

    • To be exact, the feature of Jenkins to authorize builds are available since 1.520, but who cares such details?

  • Authorize Project plugin enables you to run builds of a project as a specific user.

    • Copyartifact plugin treats builds running as an anonymous without authorization configurations.

  • You can resolve permission problems by running builds as a user with read permission to the project with artifacts

Use with declarative pipelines

One example:

stages {
    stage('Copy Archive') {
         steps {
             script {
                step ([$class: 'CopyArtifact',
                    projectName: 'Create_archive',
                    filter: "packages/infra*.zip",
                    target: 'Infra']);

What that is doing:

  • Go to the project/workspace named "Create_archive".

  • Look in the folder "packages" for the file(s) "infra*.zip".

  • Copy that file(s) into the folder "Infra", in the local workspace. Folder will be created if it doesn’t already exist.


To report a bug or request an enhancement to this plugin please create a ticket in JIRA (you need to login or to sign up for an account). Also have a look on How to report an issue

ArchivesGet past versions