pipeline { agent any tools { maven 'Maven 3' jdk 'Java 8' } options { buildDiscarder(logRotator(artifactNumToKeepStr: '20')) } stages { stage ('Build') { steps { sh 'mvn clean package' } post { success { archiveArtifacts artifacts: 'target/*.jar', excludes: 'target/*-sources.jar', fingerprint: true } } } stage ('Deploy') { when { branch "master" } steps { rtMavenDeployer( id: "maven-deployer", serverId: "opencollab-artifactory", releaseRepo: "maven-releases", snapshotRepo: "maven-snapshots" ) rtMavenResolver( id: "maven-resolver", serverId: "opencollab-artifactory", releaseRepo: "maven-deploy-release", snapshotRepo: "maven-deploy-snapshot" ) rtMavenRun( pom: 'pom.xml', goals: 'javadoc:javadoc javadoc:jar source:jar install -DskipTests', deployerId: "maven-deployer", resolverId: "maven-resolver" ) rtPublishBuildInfo( serverId: "opencollab-artifactory" ) step([$class: 'JavadocArchiver', javadocDir: 'target/site/apidocs', keepAll: false]) } } } }