Sonarqube gradle plugin can't find binaries when using implementation configuration

Versions used:
Sonarqube 7.2, Gradle Plugin 2.6.2, Android Studio 3.1.3, Gradle 4.6, Multi-Project configuration

Error Observed:
Sonarqube scanner throws “Classes not found during the analysis…” error or “Missing blame information for the following files:…” while analysing a gradle module with an implementation dependency.

Steps to reproduce:

  1. Make a Gradle Library Module or just a Gradle Module and add an implementation dependency in its dependencies section.
  2. Create a class in the module that make use of this dependency.
  3. Then run “gradle sonarqube” on the project.
  4. Sonarqube runner will warn it cannot find any of the dependency classes

Any of these won’t work:

  • implementation “com.google.firebase:firebase-core:11.8.0”
  • ext.libs = [
    firebase_base : “com.google.firebase:firebase-core:17.0.0”,
    ]
    implementation libs.firebase_base
  • implementation fileTree(dir: ‘libs’, include: [’*.jar’])
  • implementation project(’:Libs:myLibrary’)
  • implementation(project(’:Libs:myLibrary’)) {
    exclude module: ‘myBaseLibrary’
    }
  • implementation project(’:AARs:aarLibrary’) //being aarLibrary an AAR module

Being these inside the dependencies section of build.gradle file:
dependencies {
implementation …
}

Potential workaround:
SonarQube Runner Plugin for Gradle should take into account dependencies setted by implementation term. Although changing them to “api” configuration will work but also increases building time. Implementation configurations where conceived to reduce building time.

Hi Rubén,

First of all, the message:

has no relation with Gradle, but only with your SCM. It means some files are not commited when you try to run the analysis.

Regarding the classpath issue, we are relying on Gradle SourceSet::getCompileClasspath so I don’t see why it would not work. I will try to reproduce. Maybe a change of behavior in recent Gradle versions.