Creating Docker, Git, Maven, Java Pipeline
From within Dockerized Jenkins
PreRequisite Software
Create Pipeline
- Select
New Item
- Enter name of item.
- Select
Pipeline
- Click
OK
- Click
- From the
Configuration
window, select thePipeline
tab and paste theJenkinsfile
below into the textbox.
pipeline {
agent {
docker {
image 'jamesdbloom/docker-java8-maven:latest'
args '-v /root/.m2:/root/.m2'
}
}
stages {
stage('Set Up') {
steps {
script {
sh 'rm -rf maven.java-fundamentals'
}
}
}
stage('SCM Checkout') {
steps {
sh 'git clone https://github.com/curriculeon-student/maven.java-fundamentals $PWD/maven.java-fundamentals'
}
}
stage('Compile-Package-Test') {
steps {
script {
dir('$PWD/maven.java-fundamentals') {
sh "mvn package -Dmaven.test.failure.ignore=true"
}
}
}
}
}
}