It would be great to have a step to copy a Maven artifact in the workspace. It could be based on the "mvn dpeendency:copy" goal (1).

      This goal would work even if a pom.xml file does NOT exist in the workspace.

      The step could look like:

      copyMavenArtifact(artifact, [outputDirectory, outputAbsoluteArtifactFilename])
      

      We could use it like this:

      // default behavior: copy artifact under `${project.build.directory}/dependency`
      copyMavenArtifact("commons-collections:commons-collections:3.2.2:jar")
      
      // copy artifact under `target/my-folder`
      copyMavenArtifact(artifact: "commons-collections:commons-collections:3.2.2:jar", outputDirectory: "target/my-folder")
      
      // copy artifact to `/target/my-folder/commons-collections.jar`
      copyMavenArtifact(artifact: "commons-collections:commons-collections:3.2.2:jar", outputAbsoluteArtifactFilename: "${pwd()}/target/my-folder/commons-collections.jar")
      

      (1) https://maven.apache.org/plugins/maven-dependency-plugin/copy-mojo.html

          [JENKINS-33864] Add a step "copyMavenArtifact(artifact...)"

          There are no comments yet on this issue.

            rsandell rsandell
            cleclerc Cyrille Le Clerc
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: