I have a multi-project build. Artifacts (JARs) from some of subprojects are used only locally (as an internal dependencies), some other should be published to Maven repository. There are 100+ subprojects in that build and manual selection where to apply maven/maven-publish is boring and fragile.
I would like to get a list of subprojects that are dependencies (also transitive) of select subproject. In the following example:
‘’’ root |----thatSub |
|----------a1Sub |
|---- a11Sub | |
|----------a2Sub | |----otherSub ‘’’
for ‘thatSub’ I need to get ‘a1Sub’, ‘a11Sub’ and ‘a2Sub’ (without third party dependencies)
I was able to do that with recursive call of:
project(“thatSub”).configurations.compile.dependencies
.withType(DefaultProjectDependency).dependencyProject
but probably it can be done easier/prettier.
Question. How would be best to get (programatically) a list of subprojects being dependencies (also transitive) of one given subproject in the build?