From 6faf7483777c4904faf847acfba82a776180dd80 Mon Sep 17 00:00:00 2001 From: Hammy Date: Sat, 5 Jun 2021 04:18:00 +0100 Subject: [PATCH] Update Jenkinsfile Revert to simple if condition check --- Jenkinsfile | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 965cbc9..39140cf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -58,25 +58,29 @@ pipeline { } } - echo "*** File: ${javadocsArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; - echo "*** File: ${jarWithSourcesArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; - echo "*** File: ${jarArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; + if (fileExists(javadocsArtifact) && fileExists(jarWithSourcesArtifact) && fileExists(jarArtifact)) { + echo "*** File: ${javadocsArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; + echo "*** File: ${jarWithSourcesArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; + echo "*** File: ${jarArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; - nexusArtifactUploader( - nexusVersion: NEXUS_VERSION, - protocol: NEXUS_PROTOCOL, - nexusUrl: NEXUS_URL, - groupId: pom.groupId, - version: pom.version, - repository: NEXUS_REPOSITORY, - credentialsId: NEXUS_CREDENTIAL_ID, - artifacts: [ - [artifactId: pom.artifactId, classifier: 'normal', file: jarArtifact, type: pom.packaging], - [artifactId: pom.artifactId, classifier: 'javadocs', file: javadocsArtifact, type: pom.packaging], - [artifactId: pom.artifactId, classifier: 'sources', file: jarWithSourcesArtifact, type: pom.packaging], - [artifactId: pom.artifactId, classifier: '', file: "pom.xml", type: "pom"] - ] - ) + nexusArtifactUploader( + nexusVersion: NEXUS_VERSION, + protocol: NEXUS_PROTOCOL, + nexusUrl: NEXUS_URL, + groupId: pom.groupId, + version: pom.version, + repository: NEXUS_REPOSITORY, + credentialsId: NEXUS_CREDENTIAL_ID, + artifacts: [ + [artifactId: pom.artifactId, classifier: 'normal', file: jarArtifact, type: pom.packaging], + [artifactId: pom.artifactId, classifier: 'javadocs', file: javadocsArtifact, type: pom.packaging], + [artifactId: pom.artifactId, classifier: 'sources', file: jarWithSourcesArtifact, type: pom.packaging], + [artifactId: pom.artifactId, classifier: '', file: "pom.xml", type: "pom"] + ] + ) + } else { + error "*** Files could not be found"; + } } } }