Complete the Jenkins pipeline code to upload an artifact to Nexus.
sh 'curl -v -u admin:admin123 -X POST "http://nexus.example.com/repository/maven-releases/" -F "r=releases" -F "hasPom=false" -F "e=jar" -F "file=[1]"'
The artifact file to upload is the built jar file, usually located in the target/ directory.
Complete the Jenkins pipeline snippet to download an artifact from Artifactory using curl.
sh 'curl -u user:password -O http://artifactory.example.com/artifactory/libs-release-local/[1]'
The artifact path in Artifactory includes group, artifact name, version, and file name.
Fix the error in this Jenkins pipeline step to publish to Nexus by completing the missing option.
sh 'mvn deploy:deploy-file -Durl=http://nexus.example.com/repository/maven-releases/ -DrepositoryId=[1] -Dfile=target/app.jar -DgroupId=com.example -DartifactId=app -Dversion=1.0 -Dpackaging=jar'
The -DrepositoryId must match the server ID configured in Maven settings for Nexus credentials.
Fill both blanks to configure Jenkins to use Artifactory plugin for uploading artifacts.
def server = Artifactory.server('[1]') server.upload spec: '''{ "files": [ {"pattern": "build/libs/*.jar", "target": "[2]"} ] }'''
The server name matches the Jenkins Artifactory server configuration ID, and the target is the repository name in Artifactory.
Fill all three blanks to define a Jenkins pipeline step that downloads a specific artifact from Nexus using curl.
sh 'curl -u [1]:[2] -O http://nexus.example.com/repository/[3]/com/example/app/1.0/app-1.0.jar'
The username and password are for Nexus authentication, and the repository is the release repository where the artifact is stored.