Based on documentation (4.7.6 - Getting the insight into a particular dependency) we can get the insights for a particular configuration specifying the configuration itself.
In the example they are using as configuration compile
, which is deprecated.
I tried to reproduce the same command replacing, in build.gradle
, the compile
configuration with the implementation
configuration (as I got we are not supposed to use compile
anymore).
But when I run:
gradle dependencyInsight --dependency groovy --configuration implementation
Gradle is returning:
Execution failed for task ':dependencyInsight'.
Resolving configuration 'implementation' directly is not allowed
My build.gradle
file is the following:
apply plugin: 'java-library'
repositories {
jcenter()
}
dependencies{
implementation 'org.codehaus.groovy:groovy-all:2.4.10'
}
Does it mean I cannot get the insight of a dependency if I'm using implementation
or is there another way to get it?
Implementation dependencies : The references used in the relations between components are typed using concrete classes or abstract classes. Interface dependencies: The references used in the relations between components are typed using only interfaces.
If you want to visualize your dependencies in a graph you can use gradle-dependency-graph-generator plugin. Generally the output of this plugin can be found in build/reports/dependency-graph directory and it contains three files (. dot|.
In Gradle dependencies are libraries required to build your code. Each of these libraries may have their own dependencies, adding transitive dependencies to your project. This structure is called the Gradle dependency tree, with its own rules on dependency conflict resolution and more.
I had a similar problem, asked around and got this answer:
The configuration is compileClasspath
. If you have variants, there is a configuration per-variant (e.g. for the release
variant, your configuration would be releaseCompileClasspath
).
gradle dependencyInsight --dependency groovy --configuration compileClasspath
;gradle dependencyInsight --dependency groovy --configuration releaseCompileClasspath
There are a few ways to figure out the available configurations.
configurations.each { println it.name }
to your top-level gradle file, the next time you run a task, you'll also get a list of all of your configurations.dependencies
task on your top-level module - this will output all dependencies for all configurations. It can be a lot of text, so you could pipe it into a text file for easier searching (gradle dependencies > dependencies.txt
)To get the list of available configuration that can be used with dependencyInsight
, the easy way is the following :
Then you have a list of all dependencies for all available configuration, just pick one and run :
gradle :mymodule:dependencyInsight --dependency okhttp --configuration flavourDebugCompileClasspath
Hope it helps
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