forked from babsmbaye18/maven-project
-
Notifications
You must be signed in to change notification settings - Fork 67
/
jenkinsfile8
46 lines (45 loc) · 1.37 KB
/
jenkinsfile8
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
34
35
36
37
38
39
40
41
42
43
44
45
46
pipeline {
agent {label "master" }
stages {
stage('Clone codebase') {
steps {
echo 'Cloning project sources from github'
git ( url :'https://github.com/tahararib/maven-project.git', branch : 'master',
credentialsId: 'cred4github')
}
}
stage('Compiling') {
steps {
echo 'Compiling project'
withMaven(maven : 'localMaven') {
sh "mvn compile"
}
}
}
stage('Testing') {
steps {
echo 'Run Unit Tests of project'
withMaven(maven : 'localMaven') {
sh "mvn test"
}
}
}
stage('Build') {
steps {
echo 'Building project and Package'
withMaven(maven : 'localMaven') {
sh "mvn -B -DskipTests clean package"
}
}
}
stage('SonarQube Analysis') {
steps {
echo 'Run Sonar Analysis and gather stats'
withSonarQubeEnv(installationName: 'sonarServer', credentialsId:'cred4sonar')
{
sh "mvn -B -DskipTests clean package sonar:sonar"
}
}
}
}
}