forked from amruthapbhat/java-maven-junit-helloworld
-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathJenkinsfile_script
36 lines (31 loc) · 1.23 KB
/
Jenkinsfile_script
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
properties(
[
[
$class: 'BuildDiscarderProperty',
strategy: [$class: 'LogRotator', numToKeepStr: '10']
],
pipelineTriggers([cron('H * * * *')]),
]
)
node {
def mvnHome
def scannerHome
stage('Preparation') { // for display purposes
// Get some code from a GitHub repository
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'ca9b112d-19c3-491c-8e6d-23ec20cc5290', refspec: '+refs/pull/*:refs/remotes/origin/pr/*', url: 'https://github.com/amruthapbhat/java-maven-junit-helloworld']]])
// Get the Maven tool.
// ** NOTE: This 'M3' Maven tool must be configured
// ** in the global configuration.
mvnHome = tool 'Maven'
scannerHome = tool 'Sonar'
}
stage('Build') {
// Run the maven build
bat(/"${mvnHome}\bin\mvn" -Dmaven.test.failure.ignore clean install/)
}
stage ('Sonar Analysis') {
//Running Sonar Analysis
withSonarQubeEnv {
bat(/"${scannerHome}\bin\sonar-scanner" -Dsonar.projectKey=java-maven-junit-helloworld -Dsonar.sources=. /)
}
}