I am attempting to remove all out-of-date / unnecessary dependencies
from my project.
When looking at the output of the allDeps
task I can see that there are several dependencies that are replicated but the output is difficult to understand.
Is there a specific Gradle tool / task
that I can use to get a clearer view of what dependencies I can remove?
You can use ./gradlew projectName:dependencies
to see a tree of all the dependencies of your project. Both that are repeated or with different versions are remarked in the different configurations and classpaths.
WARNING: Unfortunately, the plugin fails to add its tasks to the gradle build for me using gradle 3.3. It still fails for gradle 4.3.1 (thanks to MoePad for reporting). The project seems to be not very active, so it might not work as expected.
For completeness: There is a gradle plugin available called dependency-checker which does "assist in validating project dependencies". Additional link to the gradle plugin page.
One of the tasks added is:
CheckDependencies
A Task used to validate that the build has no duplicate dependencies - a dependency with the same group and name, but with a different version. The build will be failed if any duplications are found.
It may help identifying duplicates/outdated dependencies as well.
Adding the plugin to your gradle build file:
plugins {
id "com.stehno.gradle.dependency-checker" version "0.2.2"
}
This should add the following gradle tasks:
For details about configuration and what the tasks exactly do, please refer to the github page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With