I am working in a big multi-module java maven project & my work is to setup reporting sonarQube
issue at in the pull request of bitbucket
after the build.
I have created the sonar-project.properties
according to the project structure, setup the job in jenkins
, so far this is working properly.
Now the problem is, as this is the parent of a lot of other projects, lots is new modules/sub-modules kept getting added in the project. Every time there is new module, the sonar-project.properties
have to be modified accordingly. Although that is expected, but its forgotten sometimes.
This is the reason I was thinking of, is there a way to generate the sonar-project.properties
on the fly before sonar-scanner starts executing.
This is the project structure we are following.
project-root/
moduleA/
.
.
moduleB/
submoduleOfmoduleB/
moduleC/
submoduleOfmoduleC
.
Is there any way to generate the sonar-project.properties
by reading the pom files or some other way?
You do not need to use sonar-project.properties
at all. You can use the sonar-maven-plugin with some standard properties in your pom and new projects are added automatically.
We use the following settings
<sonar.host.url>http://sonar:9000</sonar.host.url>
<sonar.junit.reportsPath>target/surefire-reports</sonar.junit.reportsPath>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.jacoco.reportPaths>target/coverage-reports/jacoco-ut.exec, target/coverage-reports/jacoco-it.exec</sonar.jacoco.reportPaths>
<sonar.exclusions>file:**/generated-sources/**,file:**/pom.xml,file:**/node_modules/**</sonar.exclusions>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.