Skip to content

Instantly share code, notes, and snippets.

@cyrille-leclerc
Last active December 6, 2016 14:43
Show Gist options
  • Save cyrille-leclerc/b9ccfbf4b57ffb78a5fc to your computer and use it in GitHub Desktop.
Save cyrille-leclerc/b9ccfbf4b57ffb78a5fc to your computer and use it in GitHub Desktop.
Jenkinsfile Maven - Game of Life
#!groovy
# https://github.com/cyrille-leclerc/game-of-life/blob/jenkinsfile/Jenkinsfile
docker.image('cloudbees/java-build-tools:0.0.6').inside {
checkout scm
def mavenSettingsFile = "${pwd()}/.m2/settings.xml"
stage 'Build Web App'
wrap([$class: 'ConfigFileBuildWrapper',
managedFiles: [[fileId: 'maven-settings-for-gameoflife', targetLocation: "${mavenSettingsFile}"]]]) {
sh "mvn -s ${mavenSettingsFile} clean source:jar javadoc:javadoc checkstyle:checkstyle pmd:pmd findbugs:findbugs package"
step([$class: 'ArtifactArchiver', artifacts: 'gameoflife-web/target/*.war'])
step([$class: 'WarningsPublisher', consoleParsers: [[parserName: 'Maven']]])
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])
step([$class: 'JavadocArchiver', javadocDir: 'gameoflife-core/target/site/apidocs/'])
// Use hudson.plugins.checkstyle.CheckStylePublisher if JSLint Publisher Plugin or JSHint Publisher Plugin is installed
step([$class: 'hudson.plugins.checkstyle.CheckStylePublisher', pattern: '**/target/checkstyle-result.xml'])
// In real life, PMD and Findbugs are unlikely to be used simultaneously
step([$class: 'PmdPublisher', pattern: '**/target/pmd.xml'])
step([$class: 'FindBugsPublisher', pattern: '**/findbugsXml.xml'])
step([$class: 'AnalysisPublisher'])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment