autonomousapps / dependency-analysis-gradle-plugin

Gradle plugin for JVM projects written in Java, Kotlin, Groovy, or Scala; and Android projects written in Java or Kotlin. Provides advice for managing dependencies and other applied plugins
Apache License 2.0
1.81k stars 120 forks source link

Lots of false positive under "Unused dependencies" : project doesn't compile anymore when removed #1232

Open NinoDLC opened 3 months ago

NinoDLC commented 3 months ago

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:

  1. Use ./gradlew buildHealth
  2. Get advice :
    Advice for :core-network:core-network
    Unused dependencies which should be removed:
    implementation(libs.rxjava2.rxjava)
    implementation(libs.threetenabp)
  3. Follow advice, remove the 2 lines
  4. Rebuild (./gradlew :core-network:core-network:assembleDebug)
  5. 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

autonomousapps commented 3 months ago

Is that all of the advice? Or is there more, like used transitive advice?