2018-03-13 11:42:39 +01:00
|
|
|
pipeline {
|
|
|
|
agent any
|
|
|
|
tools {
|
|
|
|
maven 'Maven 3'
|
|
|
|
jdk 'OracleJDK 8'
|
|
|
|
}
|
|
|
|
stages {
|
2018-03-13 21:11:35 +01:00
|
|
|
stage ('check-commit') {
|
2018-03-13 12:44:54 +01:00
|
|
|
steps {
|
2018-03-13 12:51:59 +01:00
|
|
|
script {
|
|
|
|
env.CI_SKIP = "false"
|
2018-03-13 13:03:48 +01:00
|
|
|
result = sh (script: "git log -1 | grep '(?s).[CI[-\\s]SKIP].*'", returnStatus: true)
|
2018-03-13 12:51:59 +01:00
|
|
|
if (result == 0) {
|
|
|
|
env.CI_SKIP = "true"
|
|
|
|
error "'[CI-SKIP]' found in git commit message. Aborting."
|
|
|
|
}
|
2018-03-13 12:44:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('clean') {
|
2018-03-13 11:42:39 +01:00
|
|
|
steps {
|
2018-03-13 13:03:48 +01:00
|
|
|
sh 'mvn clean'
|
2018-03-13 11:42:39 +01:00
|
|
|
}
|
|
|
|
}
|
2018-03-13 12:44:54 +01:00
|
|
|
stage ('dependencies') {
|
2018-03-13 11:42:39 +01:00
|
|
|
steps {
|
2018-03-13 21:11:35 +01:00
|
|
|
sh 'mvn dependency:resolve-plugins dependency:go-offline'
|
2018-03-13 11:42:39 +01:00
|
|
|
}
|
|
|
|
}
|
2018-03-13 12:44:54 +01:00
|
|
|
stage ('compile') {
|
2018-03-13 11:42:39 +01:00
|
|
|
steps {
|
2018-03-13 21:11:35 +01:00
|
|
|
sh 'mvn -o -DskipTests install'
|
2018-03-13 11:42:39 +01:00
|
|
|
}
|
|
|
|
}
|
2018-03-13 12:44:54 +01:00
|
|
|
stage ('test') {
|
2018-03-13 11:42:39 +01:00
|
|
|
steps {
|
2018-03-13 21:11:35 +01:00
|
|
|
sh 'mvn -o surefire:test'
|
2018-03-13 11:42:39 +01:00
|
|
|
}
|
|
|
|
post {
|
|
|
|
success {
|
|
|
|
junit 'target/surefire-reports/**/*.xml'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-03-13 12:44:54 +01:00
|
|
|
stage ('sources') {
|
2018-03-13 11:42:39 +01:00
|
|
|
when {
|
|
|
|
branch "master"
|
|
|
|
}
|
|
|
|
steps {
|
2018-03-13 13:03:48 +01:00
|
|
|
sh 'mvn -o source:jar'
|
2018-03-13 11:42:39 +01:00
|
|
|
}
|
|
|
|
post {
|
|
|
|
success {
|
|
|
|
archiveArtifacts artifacts: 'target/*-souces.jar', fingerprint: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-03-13 12:44:54 +01:00
|
|
|
stage ('javadoc') {
|
2018-03-13 11:42:39 +01:00
|
|
|
when {
|
|
|
|
branch "master"
|
|
|
|
}
|
|
|
|
steps {
|
2018-03-13 13:03:48 +01:00
|
|
|
sh 'mvn -o javadoc:javadoc javadoc:jar'
|
2018-03-13 11:42:39 +01:00
|
|
|
}
|
|
|
|
post {
|
|
|
|
success {
|
|
|
|
step([
|
|
|
|
$class: 'JavadocArchiver',
|
|
|
|
javadocDir: 'target/site/apidocs',
|
|
|
|
keepAll: true
|
|
|
|
])
|
|
|
|
archiveArtifacts artifacts: 'target/*-javadoc.jar', fingerprint: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-03-13 12:44:54 +01:00
|
|
|
stage ('deploy') {
|
2018-03-13 11:42:39 +01:00
|
|
|
when {
|
|
|
|
branch "master"
|
|
|
|
}
|
|
|
|
steps {
|
2018-03-13 21:11:35 +01:00
|
|
|
sh 'mvn -DskipTests deploy'
|
2018-03-13 11:42:39 +01:00
|
|
|
}
|
|
|
|
}
|
2018-03-13 12:54:11 +01:00
|
|
|
}
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
script {
|
|
|
|
if (env.CI_SKIP == "true") {
|
|
|
|
currentBuild.result = 'NOT_BUILT'
|
2018-03-13 12:51:59 +01:00
|
|
|
}
|
2018-03-13 12:44:54 +01:00
|
|
|
}
|
|
|
|
}
|
2018-03-13 11:42:39 +01:00
|
|
|
}
|
|
|
|
}
|