Search code examples
jenkins-pipelineartifactory

In Scripted Pipeline (pulling Jenkinsfile from SCM) approach, how do we publish artifacts to Artifactory?


In Scripted Pipeline (pulling Jenkinsfile from SCM) approach, how do we publish artifacts to Artifactory?


Solution

  • After installing Artifactory plugin in Jenkins, the below code snippet did the trick for me.

    rtUpload (serverId: "server-id",
                failNoOp: true,
                spec:
                        """{
                  "files": [
                            {
                              "pattern": "build/libs/*.jar",
                              "target": "libs-release"
                            }
                         ]
                }"""
        )