Skip to content

Instantly share code, notes, and snippets.

@cmcornejocrespo
Created May 3, 2019 13:47
Show Gist options
  • Save cmcornejocrespo/59a06bb2688bce7bf9a37d025c043531 to your computer and use it in GitHub Desktop.
Save cmcornejocrespo/59a06bb2688bce7bf9a37d025c043531 to your computer and use it in GitHub Desktop.
node {
def mvnHome = tool 'M3'
stage('Preparation') { // for display purposes
// Get some code from a GitHub repository
git url: 'https://github.com/cmcornejocrespo/webinar-bat-desk.git', branch: 'feature/jbcnconf-2017'
// Get the Maven tool.
// ** NOTE: This 'M3' Maven tool must be configured
// ** in the global configuration.
}
stage('Build') {
// Run the maven build
sh "'${mvnHome}/bin/mvn' clean package"
}
stage('Run unit tests') {
// Run the maven test
sh "'${mvnHome}/bin/mvn' test"
}
stage('Run Sonar reports') {
// Run the maven test
sh "'${mvnHome}/bin/mvn' clean install sonar:sonar -Dsonar.host.url=http://sonarqube:9000 -Psonar-coverage"
}
stage('Run Integration Tests') {
// Run integration tests
sh "'${mvnHome}/bin/mvn' clean verify -Pintegration-tests"
}
stage('Results') {
junit '**/target/surefire-reports/TEST-*.xml'
archiveArtifacts 'bat-desk-common/target/*.jar'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment