node {
    stage "Checkout"
    checkout scm
    stage 'Prepare Gradle build'
    sh "chmod +x gradlew"
    stage 'Stage Build'
    sh "./gradlew --no-daemon clean build -x findbugsMain -x findbugsTest -x test"
    stage 'Archive Artifacts'
    archiveArtifacts allowEmptyArchive: true, artifacts: '**/build/reports/*/*.xml', defaultExcludes: false, onlyIfSuccessful: true
    archiveArtifacts allowEmptyArchive: true, artifacts: '**/reports/*/*.html'
    junit allowEmptyResults: true, testResults: '**/build/test-results/*.xml'
    //step([$class: 'CheckStylePublisher', pattern: '**/build/reports/checkstyle/*.xml'])
    //step([$class: 'FindBugsPublisher', pattern: '**/build/reports/findbugs/*.xml'])
}

