-
Notifications
You must be signed in to change notification settings - Fork 0
/
Maven
33 lines (33 loc) · 927 Bytes
/
Maven
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
pipeline {
agent {
docker {
image 'abhishekf5/maven-abhishek-docker-agent:v1'
args '--user root -v /var/run/docker.sock:/var/run/docker.sock' // mount Docker socket to access the host's Docker daemon
}
}
stages {
stage('Checkout') {
steps {
sh 'echo passed'
//git branch: 'main', url: 'https://github.com/hussainshareef/Jenkins-AtoZ.git'
}
}
stage('Build and Test') {
steps {
sh 'ls -ltr'
// build the project and create a JAR file
sh 'cat pom.xml && mvn clean package'
}
}
stage('Static Code Analysis') {
environment {
SONAR_URL = "http://4.154.43.96:9000"
}
steps {
withCredentials([string(credentialsId: 'AbhiJenkins', variable: 'SONAR_AUTH_TOKEN')]) {
sh 'cat pom.xml && mvn sonar:sonar -Dsonar.login=$SONAR_AUTH_TOKEN -Dsonar.host.url=${SONAR_URL}'
}
}
}
}
}