For our code analysis I want for each maven module one sonar project. At the moment I got one sonar project with the modules from parent pom.
For my Jenkins job configuration I use SonarQube Scanner for Maven ( link ) with sonar-project.properties
.
# Root project information
sonar.projectKey=org.mycompany.myproject
sonar.projectName=My Project
sonar.projectVersion=1.0
# Some properties that will be inherited by the modules
sonar.sources=src
# List of the module identifiers
sonar.modules=module1,module2
So the expect result for my sonar would be a project one for module1
and a project two for module2
. module1
and module2
are both maven module with one parent pom.
myproject
|
->module1
|
->pom.xml (Sonar Project ONE)
->module2
|
->pom.xml (Sonar Project TWO)
->pom.xml
What is the best way to configure this behaviour in one jenkins job.
If you want to store all modules as standalone projects, then you cannot specify sonar.modules
and use SonarQube Scanner for Maven. The Maven scanner is designed to create submodules (the same structure as defined in pom.xml
files).
What you can to do:
generate in every module's root directory a sonar-project.properties
file with content:
sonar.projectKey=<project.groupId>:<project.artifactId> sonar.projectName=<project.name> sonar.projectVersion=<project.version> sonar.sourceEncoding=<project.build.sourceEncoding> sonar.sources=pom.xml,src/main sonar.tests=src/test sonar.java.binaries=<project.build.directory>/classes sonar.java.libraries=<list of all compile and provided libraries> sonar.java.test.binaries=<project.build.directory>/classes sonar.java.test.libraries=<list of all compile, provided and test libraries>
sonar-scanner
This is very not recommended because:
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.