Add a step "copyMavenArtifact(artifact...)"

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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

            Assignee:
            rsandell
            Reporter:
            Cyrille Le Clerc
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: