I’m trying to get a sub-project’s transient dependencies to resolve when using a non-standard (i.e. not provided by the Java plugin) configuration.
I have put up an an example here . But, for convenience, I will explain it here as well. My rootProject build.gradle looks as follows
allprojects {
apply plugin: 'java'
configurations {
sub0Conf {
description = 'Configuration used in sub0 sub-project'
transitive = true
}
rootProjectConf {
description = 'Configuration used in root project'
transitive = true
}
}
}
dependencies {
rootProjectConf project(':sub0')
}
and the “sub0” subproject has the following build.gradle
dependencies {
sub0Conf 'org.jmock:jmock-junit4:2.8.1'
}
and “gradle dependencies” shows
rootProjectConf - Configuration used in root project
\--- project :sub0
but not any of the dependencies the sub0 itself depends on. How can I achieve transient dependency resolution for sub-projects using non “java” plugin provided dependencies?
edeesis
(Ed Mitchell)
December 9, 2015, 4:22am
2
If you want to see the dependencies of your subprojects by running one task at the top level, create a new task in your allprojects by doing:
allprojects {
task allDeps(type:DependencyReportTask)
}
Then run allDeps.
It’s not as pretty as seeing the entire dependency tree in one place, but it does work.
You can also limit the configuration by doing:
gradle allDeps --configuration runtime
Thanks for the info - this helped me confirm that the dependencies are actually present but just not listed in the standard dependencies task gradle dependencies
.
krulls
(Stephan Krull)
August 10, 2016, 9:30am
4
“gradle dependencies --configuration runtime” This is what I searched for. And this thread Show compile dependencies only also would have liked it.
Why is this (crucial) information missing from the DependencyReportTask/configurations documentation ?
Lance_Java
(Lance Java)
August 10, 2016, 11:32am
5
rootProjectConf project(':sub0')
is equivalent to
rootProjectConf project(path: ':sub0', configuration: 'all')
I think you want
rootProjectConf project(path: ':sub0', configuration: 'sub0conf')
Or perhaps
configurations {
all.extendsFrom sub0Conf
}