In Sonar documentation there are two properties options, the sonar.tests
and sonar.binaries
.
# path to test source directories (optional)
sonar.tests=testDir1,testDir2
# path to project binaries (optional), for example directory of Java bytecode
sonar.binaries=binDir
Questions:
If sonar.tests
and sonar.binaries
are added to my Ant target, how do they show up in Sonar? What would be different in Sonar if I did/did not set these properties?
Should sonar.binaries
contain both source binaries and test binaries, or only source?
Can .jar files be given to both properties instead of path to actual .class files and/or .java files?
A SonarQube property value set via a system property overrides any value set in a build script (for the same property). When analyzing a project hierarchy, values set via system properties apply to the root project of the analyzed hierarchy. Each system property starting with ""sonar." will be taken into account.
sonar.java.binaries (required) Comma-separated paths to directories containing the compiled bytecode files corresponding to your source files. sonar.java.libraries. Comma-separated paths to files with third-party libraries (JAR or Zip files) used by your project.
On the other hand, sonar-project. properties is a project-level file and should hold project-specific values such as the location of each project's sonar. sources , and sonar. projectKey &etc.
sonar.test.inclusions. Comma-delimited list of test file path patterns to be included in analysis.
Answers:
If you do not set those 2 properties, you won't have test results ("sonar.tests") nor violations detected by Findbugs or bytecode-based tools ("sonar.binaries").
"sonar.binaries" should contain only compiled sources, not tests
No. Only "sonar.libraries" can (and actually must) point to JAR files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With