### Install Copy Artifact Plugin via CLI Source: https://plugins.jenkins.io/copyartifact/releases Use the Jenkins plugin CLI tool to install specific versions of the Copy Artifact plugin. ```bash jenkins-plugin-cli --plugins copyartifact:749.vfb_dca_a_9b_6549 ``` ```bash jenkins-plugin-cli --plugins copyartifact:746.vd2a_674fb_4f6f ``` -------------------------------- ### Troubleshoot Permission Errors Source: https://plugins.jenkins.io/copyartifact Example of an error message displayed when the plugin cannot access the source project due to incorrect naming or insufficient permissions. ```text 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 ``` -------------------------------- ### Troubleshoot Windows Agent Service Errors Source: https://plugins.jenkins.io/copyartifact Example of an error log indicating insufficient permissions for a Windows agent service to copy artifacts. ```text 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(FilePath.java:1526) at hudson.FilePath.copyRecursiveTo(FilePath.java:1451) at hudson.plugins.copyartifact.FilePathCopyMethod.copyAll(FilePathCopyMethod.java:51) ... ``` -------------------------------- ### Copy artifacts from the latest stable build Source: https://plugins.jenkins.io/copyartifact Use this syntax to copy artifacts from the most recent stable build of a specified project. ```Groovy copyArtifacts(projectName: 'sourceproject'); ``` -------------------------------- ### Copy artifacts from a specific build Source: https://plugins.jenkins.io/copyartifact Use this syntax to copy artifacts from a specific build number, often captured from a previous build step. ```Groovy def built = build('downstream'); // https://plugins.jenkins.io/pipeline-build-step copyArtifacts(projectName: 'downstream', selector: specific("${built.number}")); ``` -------------------------------- ### Configure Copy Artifact Permissions in Pipelines Source: https://plugins.jenkins.io/copyartifact Methods for defining which jobs are permitted to copy artifacts using declarative or scripted pipeline syntax. ```groovy pipeline { agent any; options { copyArtifactPermission('job1,job2,...'); } stages{...} } ``` ```groovy properties([ copyArtifactPermission('job1,job2,...'), ]); node { ... } ``` -------------------------------- ### copyArtifacts Source: https://plugins.jenkins.io/copyartifact The copyArtifacts step allows copying artifacts from a specified source project into the current workspace. ```APIDOC ## copyArtifacts ### Description Copies artifacts from another project into the current build workspace. ### Parameters - **projectName** (string) - Required - The name of the source project. - **selector** (BuildSelector) - Optional - The selector to choose which build to copy from (defaults to latest stable). - **parameters** (string) - Optional - Comma-separated name=value pairs to filter the source build. - **filter** (string) - Optional - Ant-expression to filter artifacts to copy. - **excludes** (string) - Optional - Ant-expression to exclude artifacts to copy. - **target** (string) - Optional - Target directory to copy to. - **flatten** (boolean) - Optional - Ignore directory structures of artifacts. - **optional** (boolean) - Optional - Do not fail the step if no build is found. - **fingerprintArtifacts** (boolean) - Optional - Fingerprint artifacts to track usage. - **includeBuildNumberInTargetPath** (boolean) - Optional - Include source build number in target path. ### Usage Example ```groovy copyArtifacts(projectName: 'sourceproject', selector: lastSuccessful()); ``` ``` -------------------------------- ### Copy artifacts in declarative pipeline Source: https://plugins.jenkins.io/copyartifact Use the CopyArtifact class within a script block to copy specific files from a source project workspace to the current workspace. ```groovy stages { stage('Copy Archive') { steps { script { step ([$class: 'CopyArtifact', projectName: 'Create_archive', filter: "packages/infra*.zip", target: 'Infra']); } } } ... } ``` -------------------------------- ### Declare Copy Artifact dependency in POM Source: https://plugins.jenkins.io/copyartifact/dependencies Use this XML snippet in your project's pom.xml file to include the Copy Artifact plugin as a dependency without specifying a version, relying on the Jenkins plugin BOM instead. ```xml org.jenkins-ci.plugins copyartifact ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.