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