Skip to content

Instantly share code, notes, and snippets.

@awsvpc
Forked from NicolasGeraud/Jenkinsfile
Created February 8, 2026 21:35
Show Gist options
  • Select an option

  • Save awsvpc/c9db0441c4ddde788e1ad76545948dde to your computer and use it in GitHub Desktop.

Select an option

Save awsvpc/c9db0441c4ddde788e1ad76545948dde to your computer and use it in GitHub Desktop.
node("Agent001") {
def server
def buildInfo
stage ('Checkout') {
checkout scm
}
stage ('Artifactory configuration') {
server = Artifactory.server "sprint0-artifactory"
rtMaven = Artifactory.newMavenBuild()
rtMaven.tool = "mvn"
rtMaven.deployer releaseRepo: 'private-releases', snapshotRepo: 'private-snapshots', server: server
buildInfo = Artifactory.newBuildInfo()
}
stage ("Build") {
rtMaven.run pom: 'pom.xml', goals: 'clean install', buildInfo: buildInfo
}
stage ('Publish build info') {
try {
sh "ls **/target/surefire-reports/TEST-*.xml"
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])
} catch (Exception ex) {
echo "No tests to archive"
}
try {
sh "ls target/surefire-reports/TEST-*.xml"
step([$class: 'JUnitResultArchiver', testResults: 'target/surefire-reports/TEST-*.xml'])
} catch (Exception ex) {
echo "No tests to archive"
}
server.publishBuildInfo buildInfo
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment