Menu

Same Gradle dependency flagged across 14 modules? That's one convention plugin, not 14 problems.

DEV Community: kotlin·Stefan Wärting·6 months ago
#phLZ1tAJ
#dev#class#plugin#code#convention
Reading 0:00
15s threshold

If you run the Dependency Analysis Gradle Plugin (DAGP from here on) on a real project for the first time, the buildHealth report will be long. That's expected. But scroll through it and you'll probably see the same piece of advice repeated across a lot of modules:

: feature: search -- Unused dependencies which should be removed: implementation ( "com.squareup.okhttp3:okhttp:4.12.0" )

: feature: profile -- Unused dependencies which should be removed: implementation ( "com.squareup.okhttp3:okhttp:4.12.0" )

: feature: settings -- Unused dependencies which should be removed: implementation ( "com.squareup.okhttp3:okhttp:4.12.0" )

( and twelve more )

The obvious reaction is to start deleting, module by module. Fourteen tiny PRs. Don't.

When the same dependency shows up as unused across a big slice of your module graph, the cause is usually that a convention plugin is adding it to every module that applies it.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.