forked from Alliedium/springboot-api-rest-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
61 lines (57 loc) 路 1.99 KB
/
Jenkinsfile
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
pipeline {
agent any
stages {
stage('Build'){
steps{
echo 'Download dependencies'
// withMaven(maven:"maven", publisherStrategy: 'EXPLICIT'){
sh "pwd\n\
ls -la\n\
cd api \n\
ls -la\n\
mvn install -DskipTests"
// }
}
}
stage('Test'){
steps{
script{
echo 'Test'
sh "pwd\n\
cd api\n\
mvn test jacoco:report"
}
publishHTML([
allowMissing: true,
keepAll:true,
alwaysLinkToLastBuild: true,
reportDir: 'api/target/site/jacoco',
reportFiles: 'index.html',
reportName: 'Jacoco coverage HTML report'])
}
}
stage('Static code analysis'){
steps{
script{
echo 'Static code analysis'
sh "cd api\n\
echo \"static code analysis finished\"\n\
mvn -X clean pmd:pmd pmd:cpd findbugs:findbugs checkstyle:checkstyle \n\
echo \"static code analysis finished\""
}
echo "Reading static analysis report"
recordIssues enabledForFailure: true, failOnError: false, tool:checkStyle(pattern: "**/target/checkstyle-result.xml")
recordIssues enabledForFailure: true, failOnError: false, tool:findBugs(pattern: "**/target/findbugs*.xml")
recordIssues enabledForFailure: true, failOnError: false, tool:cpd(pattern: "**/target/cpd.xml")
recordIssues enabledForFailure: true, failOnError: false, tool:pmdParser(pattern: "**/target/pmd.xml")
}
}
}
}
// def runStaticCodeAnalysis(){
// withMaven(maven: "maven-387", publisherStrategy: 'EXPLICIT'){
// sh "cd api\n\
// echo \"static code analysis finished\"\n\
// mvn -X clean checkstyle:checkstyle\n\
// echo \"static code analysis finished\""}
// }