From 56c191758a41cb1fed814cb0bd67026b999a3dca Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Wed, 24 Feb 2021 10:46:46 +0100 Subject: [PATCH] OZG-199 add sonarqube --- Jenkinsfile | 12 ++++++++---- pluto-server/pom.xml | 21 +++++++++++++++++++++ pluto-server/sonar-project.properties | 2 ++ 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 pluto-server/sonar-project.properties diff --git a/Jenkinsfile b/Jenkinsfile index cf521f691..4bd700bab 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,8 +26,10 @@ pipeline { container("maven-11"){ sh 'mvn --version' dir('pluto-interface') { - configFileProvider([configFile(fileId: '9aac2fac-7d8d-4128-846b-0a61951df703', variable: 'MAVEN_SETTINGS')]) { - sh 'mvn -s $MAVEN_SETTINGS clean install' + withSonarQubeEnv('sonarqube'){ + configFileProvider([configFile(fileId: '9aac2fac-7d8d-4128-846b-0a61951df703', variable: 'MAVEN_SETTINGS')]) { + sh 'mvn -s $MAVEN_SETTINGS clean install sonar:sonar' + } } } } @@ -63,8 +65,10 @@ pipeline { container("maven"){ sh 'mvn --version' dir('pluto-server') { - configFileProvider([configFile(fileId: '9aac2fac-7d8d-4128-846b-0a61951df703', variable: 'MAVEN_SETTINGS')]) { - sh 'mvn -s $MAVEN_SETTINGS clean install' + withSonarQubeEnv('sonarqube'){ + configFileProvider([configFile(fileId: '9aac2fac-7d8d-4128-846b-0a61951df703', variable: 'MAVEN_SETTINGS')]) { + sh 'mvn -s $MAVEN_SETTINGS clean install sonar:sonar' + } } } } diff --git a/pluto-server/pom.xml b/pluto-server/pom.xml index 88944d411..63eedbc7f 100644 --- a/pluto-server/pom.xml +++ b/pluto-server/pom.xml @@ -145,6 +145,27 @@ </execution> </executions> </plugin> + + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <version>0.8.6</version> + <executions> + <execution> + <id>start-agent</id> + <goals> + <goal>prepare-agent</goal> + </goals> + </execution> + <execution> + <id>generate-report</id> + <phase>package</phase> + <goals> + <goal>report</goal> + </goals> + </execution> + </executions> + </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> diff --git a/pluto-server/sonar-project.properties b/pluto-server/sonar-project.properties new file mode 100644 index 000000000..10d23d8d9 --- /dev/null +++ b/pluto-server/sonar-project.properties @@ -0,0 +1,2 @@ +sonar.java.coveragePlugin=jacoco +sonar.jacoco.reportPath=target/jacoco.exec \ No newline at end of file -- GitLab