Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sonar tests and binaries properties, what do they do?

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:

  1. 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?

  2. Should sonar.binaries contain both source binaries and test binaries, or only source?

  3. Can .jar files be given to both properties instead of path to actual .class files and/or .java files?

like image 504
user1340582 Avatar asked Dec 10 '12 06:12

user1340582


People also ask

What are the properties of sonar?

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.

What is Sonar Java binaries property?

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.

What is the use of sonar project properties file?

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.

What is Sonar Test inclusions?

sonar.test.inclusions. Comma-delimited list of test file path patterns to be included in analysis.


1 Answers

Answers:

  1. 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").

  2. "sonar.binaries" should contain only compiled sources, not tests

  3. No. Only "sonar.libraries" can (and actually must) point to JAR files.

like image 91
Fabrice - SonarSource Team Avatar answered Sep 23 '22 15:09

Fabrice - SonarSource Team