mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-26 08:55:49 +00:00
restore
This commit is contained in:
parent
aea1b7d7c6
commit
7a30f44e5a
1 changed files with 43 additions and 31 deletions
20
Jenkinsfile
vendored
20
Jenkinsfile
vendored
|
@ -24,16 +24,23 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('push') {
|
|
||||||
|
stage("publish to nexus") {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
|
// Read POM xml file using 'readMavenPom' step , this step 'readMavenPom' is included in: https://plugins.jenkins.io/pipeline-utility-steps
|
||||||
pom = readMavenPom file: "pom.xml";
|
pom = readMavenPom file: "pom.xml";
|
||||||
|
// Find built artifact under target folder
|
||||||
filesByGlob = findFiles(glob: "target/*.${pom.packaging}");
|
filesByGlob = findFiles(glob: "target/*.${pom.packaging}");
|
||||||
|
// Print some info from the artifact found
|
||||||
echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}"
|
echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}"
|
||||||
|
// Extract the path from the File found
|
||||||
artifactPath = filesByGlob[0].path;
|
artifactPath = filesByGlob[0].path;
|
||||||
|
// Assign to a boolean response verifying If the artifact name exists
|
||||||
artifactExists = fileExists artifactPath;
|
artifactExists = fileExists artifactPath;
|
||||||
}
|
|
||||||
when(artifactExists) {
|
if(artifactExists) {
|
||||||
|
echo "*** File: ${artifactPath}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}";
|
||||||
|
|
||||||
nexusArtifactUploader(
|
nexusArtifactUploader(
|
||||||
nexusVersion: NEXUS_VERSION,
|
nexusVersion: NEXUS_VERSION,
|
||||||
|
@ -44,17 +51,22 @@ pipeline {
|
||||||
repository: NEXUS_REPOSITORY,
|
repository: NEXUS_REPOSITORY,
|
||||||
credentialsId: NEXUS_CREDENTIAL_ID,
|
credentialsId: NEXUS_CREDENTIAL_ID,
|
||||||
artifacts: [
|
artifacts: [
|
||||||
|
// Artifact generated such as .jar, .ear and .war files.
|
||||||
[artifactId: pom.artifactId,
|
[artifactId: pom.artifactId,
|
||||||
classifier: '',
|
classifier: '',
|
||||||
file: artifactPath,
|
file: artifactPath,
|
||||||
type: pom.packaging],
|
type: pom.packaging],
|
||||||
|
|
||||||
|
// Lets upload the pom.xml file for additional information for Transitive dependencies
|
||||||
[artifactId: pom.artifactId,
|
[artifactId: pom.artifactId,
|
||||||
classifier: '',
|
classifier: '',
|
||||||
file: "pom.xml",
|
file: "pom.xml",
|
||||||
type: "pom"]
|
type: "pom"]
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
} else {
|
||||||
|
error "*** File: ${artifactPath}, could not be found";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue