Update Jenkinsfile

Try to upload 3 jar files and pom.xml
pull/3/head
Hammy 3 years ago
parent add17d8a75
commit a8503a2641

59
Jenkinsfile vendored

@ -40,35 +40,42 @@ pipeline {
echo "${filesByGlob[1].name} ${filesByGlob[1].path} ${filesByGlob[1].directory} ${filesByGlob[1].length} ${filesByGlob[1].lastModified}" echo "${filesByGlob[1].name} ${filesByGlob[1].path} ${filesByGlob[1].directory} ${filesByGlob[1].length} ${filesByGlob[1].lastModified}"
echo "${filesByGlob[2].name} ${filesByGlob[2].path} ${filesByGlob[2].directory} ${filesByGlob[2].length} ${filesByGlob[2].lastModified}" echo "${filesByGlob[2].name} ${filesByGlob[2].path} ${filesByGlob[2].directory} ${filesByGlob[2].length} ${filesByGlob[2].lastModified}"
javadocsArtifact = filesByGlob[0].path;
jarWithSourcesArtifact = filesByGlob[1].path;
jarArtifact = filesByGlob[2].path;
artifactPath = filesByGlob[0].path; when {
artifactExists = fileExists artifactPath; allOf {
expression {
if (artifactExists) { return fileExists javadocsArtifact
echo "*** File: ${artifactPath}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; }
expression {
return fileExists jarWithSourcesArtifact
}
expression {
return fileExists jarArtifact
}
}
}
nexusArtifactUploader( echo "*** File: ${javadocsArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}";
nexusVersion: NEXUS_VERSION, echo "*** File: ${jarWithSourcesArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}";
protocol: NEXUS_PROTOCOL, echo "*** File: ${jarArtifact}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}";
nexusUrl: NEXUS_URL,
groupId: pom.groupId,
version: pom.version,
repository: NEXUS_REPOSITORY,
credentialsId: NEXUS_CREDENTIAL_ID,
artifacts: [
[artifactId: pom.artifactId,
classifier: '',
file: artifactPath,
type: pom.packaging],
[artifactId: pom.artifactId, nexusArtifactUploader(
classifier: '', nexusVersion: NEXUS_VERSION,
file: "pom.xml", protocol: NEXUS_PROTOCOL,
type: "pom"] nexusUrl: NEXUS_URL,
] groupId: pom.groupId,
) version: pom.version,
} else { repository: NEXUS_REPOSITORY,
error "*** File: ${artifactPath}, could not be found"; 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"]
])
} }
} }
} }

Loading…
Cancel
Save