How to find/remove unused dependencies in Gradle

后端 未结 6 1019
花落未央
花落未央 2020-11-30 18:28

I wanted to find unused dependencies in my project. Is there a feature for this in Gradle, like in Maven?

6条回答
  •  孤城傲影
    2020-11-30 18:40

    The project mentioned in the earlier answers seem to be dead. I use gradle-dependency-analyze. Setup is simple:

    buildscript {
      repositories {
        jcenter()
      }
      dependencies {
        classpath 'ca.cutterslade.gradle:gradle-dependency-analyze:1.0.3'
      }
    }
    
    apply plugin: 'ca.cutterslade.analyze'
    

    Then do:

    $ gradle analyzeDependencies
    

提交回复
热议问题