diff --git a/Jenkinsfile b/Jenkinsfile index cf521f691f9f2bfa3274ed2090c5f238ee6122e0..4bd700bab37ce6a72dfca371ba35f85465e8b9f3 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 88944d411264db0a1696b78bd737976b21181272..63eedbc7f5de2defd5f234bc15869befc3bfb308 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 0000000000000000000000000000000000000000..10d23d8d9f30c9557e9556b91bda10dbe9c61dd5 --- /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