dependency-analysis-gradle-plugin
dependency-analysis-gradle-plugin copied to clipboard
Lots of false positive under "Unused dependencies" : project doesn't compile anymore when removed
Build scan link
https://scans.gradle.com/s/wrruxaf2etxw2 (not working because I've removed the dependency as hinted by the plugin)
https://scans.gradle.com/s/3stvxpgsu6fqc (working with the dependency back)
Plugin version 1.32.0
Gradle version 8.6
JDK version 17
(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version Kotlin : 1.9.24
(Optional) Android Gradle Plugin (AGP) version AGP : 8.2.2
(Optional) reason output for bugs relating to incorrect advice
./gradlew :core-network:core-network:reason --id com.jakewharton.threetenabp:threetenabp:1.3.1
> Task :core-network:core-network:reason
----------------------------------------
You asked about the dependency 'com.jakewharton.threetenabp:threetenabp:1.3.1 (libs.threetenabp)'.
You have been advised to remove this dependency from 'implementation'.
----------------------------------------
Shortest path from :core-network:core-network to com.jakewharton.threetenabp:threetenabp:1.3.1 (libs.threetenabp) for debugCompileClasspath:
:core-network:core-network
\--- com.jakewharton.threetenabp:threetenabp:1.3.1
Shortest path from :core-network:core-network to com.jakewharton.threetenabp:threetenabp:1.3.1 (libs.threetenabp) for debugRuntimeClasspath:
:core-network:core-network
\--- com.jakewharton.threetenabp:threetenabp:1.3.1
Shortest path from :core-network:core-network to com.jakewharton.threetenabp:threetenabp:1.3.1 (libs.threetenabp) for debugUnitTestCompileClasspath:
:core-network:core-network
\--- com.jakewharton.threetenabp:threetenabp:1.3.1
Shortest path from :core-network:core-network to com.jakewharton.threetenabp:threetenabp:1.3.1 (libs.threetenabp) for debugUnitTestRuntimeClasspath:
:core-network:core-network
\--- com.jakewharton.threetenabp:threetenabp:1.3.1
Shortest path from :core-network:core-network to com.jakewharton.threetenabp:threetenabp:1.3.1 (libs.threetenabp) for debugAndroidTestCompileClasspath:
:core-network:core-network
\--- com.jakewharton.threetenabp:threetenabp:1.3.1
Shortest path from :core-network:core-network to com.jakewharton.threetenabp:threetenabp:1.3.1 (libs.threetenabp) for debugAndroidTestRuntimeClasspath:
:core-network:core-network
\--- com.jakewharton.threetenabp:threetenabp:1.3.1
Shortest path from :core-network:core-network to com.jakewharton.threetenabp:threetenabp:1.3.1 (libs.threetenabp) for releaseCompileClasspath:
:core-network:core-network
\--- com.jakewharton.threetenabp:threetenabp:1.3.1
Shortest path from :core-network:core-network to com.jakewharton.threetenabp:threetenabp:1.3.1 (libs.threetenabp) for releaseRuntimeClasspath:
:core-network:core-network
\--- com.jakewharton.threetenabp:threetenabp:1.3.1
Shortest path from :core-network:core-network to com.jakewharton.threetenabp:threetenabp:1.3.1 (libs.threetenabp) for releaseUnitTestCompileClasspath:
:core-network:core-network
\--- com.jakewharton.threetenabp:threetenabp:1.3.1
Shortest path from :core-network:core-network to com.jakewharton.threetenabp:threetenabp:1.3.1 (libs.threetenabp) for releaseUnitTestRuntimeClasspath:
:core-network:core-network
\--- com.jakewharton.threetenabp:threetenabp:1.3.1
Source: debug, main
-------------------
(no usages)
Source: release, main
---------------------
(no usages)
Source: debug, test
-------------------
(no usages)
Source: release, test
---------------------
(no usages)
Source: debug, android_test
---------------------------
(no usages)
BUILD SUCCESSFUL in 18s
Describe the bug
To Reproduce Steps to reproduce the behavior:
- Use
./gradlew buildHealth - Get advice :
Advice for :core-network:core-network
Unused dependencies which should be removed:
implementation(libs.rxjava2.rxjava)
implementation(libs.threetenabp)
- Follow advice, remove the 2 lines
- Rebuild (
./gradlew :core-network:core-network:assembleDebug) - Build fails :
> Task :core-network:core-network:compileDebugKotlin FAILED
e: file:///C:/Work/lapresse/LaPresse/core-network/core-network/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt:8:12 Unresolved reference: threeten
(...)
Expected behavior Build should not fail after follow an advice
Is that all of the advice? Or is there more, like used transitive advice?
I'd guess this is because ignoring used transitive dependencies doesn't seem to be taken into account by the unused dependency reporting. In this case, the report states that a dependency is unused because the module is using a transitive but doesn't report the transitive info because it's turned off.
Would it be possible to update the unused dependency report to consider whether used transitives are ignored?