Before writing your pipeline code, ensure your Jenkins environment is connected to your Artifactory instance:
node { // Reference the Server ID configured in Jenkins System settings def server = Artifactory.server 'artifactory-main' // Define the download specification def downloadSpec = """{ "files": [ { "pattern": "libs-release-local/com/example/my-app/1.0.0/*.jar", "target": "downloads/", "flat": "true" } ] }""" // Execute the download server.download spec: downloadSpec } Use code with caution. Declarative Pipeline Syntax Artifactory Plugin - Jenkins artifactory download jenkins pipeline
The primary way to achieve this is via the Jenkins Artifactory Plugin . 1. Initial Setup and Configuration Before writing your pipeline code, ensure your Jenkins
: Go to Manage Jenkins > System (or Configure System ) and locate the JFrog Platform section. Initial Setup and Configuration : Go to Manage
In a scripted pipeline, you first retrieve the server instance and then execute the download method.
Add a new server with a unique (e.g., artifactory-main ).
Provide the (e.g., https://your-company.jfrog.io/artifactory ). Add Credentials (Username/API Key or Access Token). 2. Downloading Artifacts in a Pipeline