Depending on your pipeline's complexity, you can use built-in shell commands, specialized plugins, or standard build tools.
Use the Nexus Search API to dynamically fetch the "latest" version by appending &sort=version to your request. 2. Using the "Nexus Platform" Plugin jenkins download jar from nexus
pipeline { agent any stages { stage('Download JAR') { steps { withCredentials([usernamePassword(credentialsId: 'nexus-auth', usernameVariable: 'USER', passwordVariable: 'PASS')]) { sh "curl -u $USER:$PASS -L 'http://your-nexus-url:8081/service/rest/v1/search/assets/download?repository=maven-releases&maven.groupId=com.example&maven.artifactId=my-app&maven.extension=jar&sort=version' -o my-app.jar" } } } } } Use code with caution. Depending on your pipeline's complexity, you can use