4

I have a multi-module project using Java, Gradle and spring boot. In order to figure out whether I have any unused dependencies that I can cleanup I tried to use the Nebula Gradle Lint Plugin to find unused or undeclared dependencies.

I try to it as recommended in the documentation by applying the plugin in the allProjects block.

plugins {
    id "nebula.lint" version "16.17.0"
    id "org.jetbrains.kotlin.jvm" version "$kotlin_version"
    id "org.jetbrains.kotlin.plugin.spring" version "$kotlin_version"
    id "org.jetbrains.kotlin.plugin.jpa" version "$kotlin_version"
}

allProjects {
    apply plugin: "nebula.lint"
    gradleLint.alwaysRun = false
    gradleLint.rules = ['all-dependency', 'unused-dependency'] 
}

When I run this configuration I get > 1000 warnings. Many of them being

this dependency should be removed since its artifact is empty (no auto-fix available)

or

one or more classes in XXX (e.g: org.springframework:spring-aop:5.3.3) are required by your code directly (no auto-fix available)

Which looks to me as if this gradle lint plugin can not properly handle projects that also have the spring boot dependency plugin and uses starter dependencies.

Am I doing something wrong here or is there another gradle linter, that can help me with finding unused dependencies even if I have spring's dependency management plugin enabled?

peach
  • 657
  • 5
  • 26
  • I have same questions and I just started using this, did you get any answer for this? – M S Kulkarni Jul 18 '23 at 15:27
  • Nope, no new insights. I think those two plugins just don't go together very well. I also couldn't find another plugin that was helpful. – peach Jul 19 '23 at 07:43

0 Answers0