I have a pipeline that compiles a pom.xml, generates a jar file and uploads it to my local artifactory.
When I try to upload the jar file to artifactory using rtUpload() I am getting this error even though the file exists in my workspace (the build is succssfull and in my workspace the jar is generated).
This is how I have configure my jenkins script:
pipeline {
agent anyenvironment { VERSION = "${env.BUILD_NUMBER}" PROJECT_REPO = '****' POM_DIR = 'pom.xml' } stages { stage('Artifactory Configuration') { steps { rtServer( id: 'central', url: '***', credentialsId: 'jfrog' ) } } stage('Clone') { steps { git( url: PROJECT_REPO, credentialsId: 'git', branch: 'master' ) } } stage('Build') { steps{ script { pom = readMavenPom file: 'pom.xml' env.PROJECT_NAME = pom.artifactId sh 'mvn -B -DskipTests clean package' sh "sed 's/REPLACE_VERSION_HERE/${env.VERSION}/g' upload-pom.xml > upload-pom-${env.VERSION}.xml" echo "$WORKSPACE" echo "${env.PROJECT_NAME}" // zip zipFile: "${env.PROJECT_NAME}-${env.VERSION}-distribution.zip", archive: true, dir: 'dist' } } } stage('Upload Artifactory') { steps { rtUpload( serverId: 'central', spec: '''{ "files": [ { "pattern": "$WORKSPACE/target/JavaLibraryKoarioMaven-1.2-SNAPSHOT.jar", "target": "koariomaven/com/koario/fr/JavaLibraryKoarioMaven/${env.VERSION}/" } ] }''', failNoOp: true, ) } } } post { always { emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}", recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']], subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}" } }
}
Here are my build logs:
[INFO] Building jar: /var/lib/jenkins/workspace/Java Library Koario (Maven Pipeline)/target/JavaLibraryKoarioMaven-1.2-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.521 s
[INFO] Finished at: 2022-11-24T17:07:24+01:00
[INFO] ------------------------------------------------------------------------
[Pipeline] sh
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Upload Artifactory)
[Pipeline] rtUpload
Executing command: /bin/sh -c git log --pretty=format:%s -1
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] emailext
An attempt to send an e-mail to empty list of recipients, ignored.
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.lang.RuntimeException: Fail-no-op: No files were affected in the upload process.
at org.jfrog.hudson.pipeline.common.executors.GenericUploadExecutor.execute(GenericUploadExecutor.java:59)
at org.jfrog.hudson.pipeline.declarative.steps.generic.UploadStep$Execution.runStep(UploadStep.java:39)
at org.jfrog.hudson.pipeline.declarative.steps.generic.UploadStep$Execution.runStep(UploadStep.java:24)
at org.jfrog.hudson.pipeline.ArtifactorySynchronousNonBlockingStepExecution.run(ArtifactorySynchronousNonBlockingStepExecution.java:55)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
/var/lib/jenkins/workspace/Java Library Koario (Maven Pipeline)@tmp/jfrog/69/.jfrog deleted
Finished: FAILURE
Thank you in advance.