Slackbot
04/12/2023, 4:33 AMVampire
04/12/2023, 6:41 AMProjectDependency
iircAdam
04/12/2023, 7:38 AMtasks.register("printSubprojectDependencies") {
group = "help"
val subprojectNames = configurations.compileClasspath.map { conf ->
conf
.incoming
.artifactView {
componentFilter { it is ProjectComponentIdentifier }
}.artifacts
.artifacts
.map { it.id.displayName }
}
inputs.property("subprojectNames", subprojectNames)
doLast {
logger.lifecycle(subprojectNames.get().joinToString())
}
}
but that only logs incoming subproject dependencies. And it’s the compile-time only, but you can tweak it to also log the runtimeClasspath.
If
• subproject-b
and subproject-c
depend on subproject-a
,
• and you want a task inside subproject-a
that prints “I’m used by subproject-b and subproject-c” ,
then that might be a little more difficult. Subprojects aren’t supposed to know how other subprojects are configured.