SonarQube: Bytecode of dependencies missing despite Maven usage

8.4k views Asked by At

I use the sonar-maven-plugin version 3.4.0.905 to SonarQube-scan a flat hierarchy, multi-module Maven project. I have noticed a warning in the log of one of the 14 modules I scan.

[WARNING] Bytecode of dependencies was not provided for analysis of source files, you might end up with less precise results. Bytecode can be provided using sonar.java.libraries property

What could cause this issue? My understanding is that the sonar.java.libraries property only needs to be used when not using Maven. Am I mistaken? How can I best troubleshoot this issue?

2

There are 2 answers

0
TheStarkCoder On

Try adding this line of code in your sonar-project.properties file:

sonar.java.binaries=**/target/classes

You can read more info at: https://docs.sonarqube.org/latest/analysis/languages/java/

0
Marcelo Vinicius On

You've to add sonar.java.libraries as well. In this attribute you can add comma-separated paths to files with third-party libraries (JAR or Zip files) that are used by your project. Wildcards can be used:

Examples:

sonar.java.libraries=path/to/Library.jar,directory/**/*.jar