This is a bug report on Sonarqube Gradle plugin.
I’m not sure this forum is the right place to send bug reports. I first tried to find an “issues” tab on GitHub - SonarSource/sonar-scanner-gradle: SonarQube Scanner for Gradle · GitHub but none is available and here was the closest I could find.
Setup:
- android app project
- gradle: 9.5.1
- android gradle plugin: com.android.application:9.2.1
- licensee plugin: app.cash.licensee:1.14.1
- sonarqube plugin: org.sonarqube:7.3.0.8198
Issue:
When using the licensee plugin option to export the .json file with collected project dependencies to the Android project (to allow us to display it on the app GUI)
licensee {
bundleAndroidAsset = true
}
the sonar task fails with:
Executing tasks: [sonar] in project ~/AndroidStudioProjects/SonarPluginBug
> Task :sonarResolver
> Task :app:sonarResolver FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:sonarResolver' (registered by plugin 'org.sonarqube').
> Querying the mapped value of list(interface java.util.Collection, item(list(interface org.gradle.api.file.Directory, [~/AndroidStudioProjects/SonarPluginBug/app/src/main/assets])) + item(list(interface org.gradle.api.file.Directory, [~/AndroidStudioProjects/SonarPluginBug/app/src/debug/assets])) + item(list(interface org.gradle.api.file.Directory, item(flatmap(provider(task 'copyDebugLicenseeReportToAssets', class app.cash.licensee.AssetCopyTask)))))) before task ':app:copyDebugLicenseeReportToAssets' has completed is not supported
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights from a Build Scan (powered by Develocity).
> Get more help at https://help.gradle.org.
BUILD FAILED in 195ms
2 actionable tasks: 2 executed
11:00:06: Execution finished 'sonar'.
Currently I’m working around the issue by disabling the licensee task when running ./gradlew sonar.
Attached is a zip with a reproducible case, it is very basic, just a blank project open “Android Studio → New → New Project …”, add the 2 plugins, configure the licensee, and try to run sonar task.
SonarPluginBug.zip (97.6 KB)