dependency-analysis-gradle-plugin
dependency-analysis-gradle-plugin copied to clipboard
Generated advice does not use version catalog aliases when DAGP is applied as settings plugin
Plugin version
2.17.0
Gradle version
8.12
JDK version
21
(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version
2.1.20
Describe the bug
When applying DAGP via the build-health settings plugin, the generated advice does not use the dependency aliases from the Gradle version catalog. When applying DAGP via the dependency-analysis plugin to the root project (and subprojects), the version catalog aliases are used as expected.
To Reproduce Steps to reproduce the behavior:
- Add the
build-healthplugin tosettings.gradle.ktsas described here. - Add an unused dependency from the version catalog to one of the modules. E.g.
implementation(libs.okhttp). - The plugin generates the following advice:
Unused dependencies which should be removed:
implementation("com.squareup.okhttp3:okhttp:4.12.0")
Expected behavior
The plugin should generate the advice using the dependency alias from the version catalog:
Unused dependencies which should be removed:
implementation(libs.okhttp)
This is working as expected in the exact same project when applying DAGP via the root project plugin (as described here) instead of the settings plugin.
Additional context
I'm unsure if this is related to the fact that Gradle version catalogs are not available to settings plugins. I assumed, though, that this would work the same no matter how the plugin is applied, so it's unexpected behavior to me.
I've created a simple reproducer: dagp-catalog-repro.zip
Thanks for the report and reproducer.
Looks to be the same for typesafe project accessors - should I open a new issue for that?
Looks to be the same for typesafe project accessors - should I open a new issue for that?
do you mean specifically for the settings plugin? If so, yes please create a new issue.
https://github.com/autonomousapps/dependency-analysis-gradle-plugin/blob/main/CHANGELOG.md#version-351