diff --git a/Jenkinsfile b/Jenkinsfile index 8867de032e76dcb7a9ed6956758607cb3601e2a7..5996a885e716640c0d7602f83e05a8ce16306d2c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,9 +24,11 @@ pipeline { FAILED_STAGE=env.STAGE_NAME } container("maven"){ - configFileProvider([configFile(fileId: '9aac2fac-7d8d-4128-846b-0a61951df703', variable: 'MAVEN_SETTINGS')]) { - sh 'mvn --version' - sh 'mvn -s $MAVEN_SETTINGS clean install' + withSonarQubeEnv('sonarqube'){ + configFileProvider([configFile(fileId: '9aac2fac-7d8d-4128-846b-0a61951df703', variable: 'MAVEN_SETTINGS')]) { + sh 'mvn --version' + sh 'mvn -s $MAVEN_SETTINGS clean install sonar:sonar' + } } } } diff --git a/pom.xml b/pom.xml index ebcf18804a998b2f0de83b4cac7ab2f1bc42ad55..949c3907320cf8e8cca5a2564e681507d18ed7f4 100644 --- a/pom.xml +++ b/pom.xml @@ -241,6 +241,26 @@ </configuration> </plugin> <!-- end::wsdl[] --> + <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> </plugins> </build> diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000000000000000000000000000000000000..10d23d8d9f30c9557e9556b91bda10dbe9c61dd5 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,2 @@ +sonar.java.coveragePlugin=jacoco +sonar.jacoco.reportPath=target/jacoco.exec \ No newline at end of file