I have a multiproject build with two projects: ProjA and ProjB.
ProjB has a compile dependency on ProjA. The ProjB build.gradle has:
dependencies {
compile project(':ProjA') // depend on the other project
compile 'commons-io:commons-io:2.4'
testCompile 'junit:junit:4.12'
}
When I do the command below, I see the dependency on ProjA from ProjB:
gradle -q dependencies ProjB:dependencies --configuration compile
------------------------------------------------------------
Root project
------------------------------------------------------------
No configurations
------------------------------------------------------------
Project :ProjB
------------------------------------------------------------
compile - Dependencies for source set 'main' (deprecated, use 'implementation ' instead).
+--- log4j:log4j:1.2.16
+--- project :ProjA
| \--- log4j:log4j:1.2.16
\--- commons-io:commons-io:2.4
However, there is no real dependency in the source code for this project. I can remove ProjA as a dependency in ProjB build.gradle. So in other words, how do I find unused/not needed project dependencies? This is sort of like the common use-case of trying to find unused jars in the classpath.
I inherited some legacy code and their build scripts are a mess…but legacy is what it is.