Simplest backwards compatible solution is to do this:
task snapshotTask { task ->
subprojects {
afterEvaluate {
task.dependsOn tasks.names.findAll { it.endsWith("ToJcenterRepository") }*.path
}
}
}
This would be simpler to express via rules, but we don’t yet have constructs for crossing boundaries via rules.