Slackbot
09/25/2022, 9:06 PMVampire
09/25/2022, 9:11 PMJohn
09/25/2022, 9:29 PMJohn
09/25/2022, 9:29 PMVampire
09/25/2022, 9:31 PMJohn
09/25/2022, 9:33 PMplugins.withType<MavenPublishPlugin> {
}
John
09/25/2022, 9:33 PMJohn
09/25/2022, 9:33 PMJohn
09/25/2022, 9:33 PMVampire
09/25/2022, 9:34 PMtasks.withType
John
09/25/2022, 9:34 PMVampire
09/25/2022, 9:35 PMtasks.named
only works if a task is already registered.John
09/25/2022, 9:35 PMVampire
09/25/2022, 9:36 PMtasks.withType<...>().matching { it.name == "..." }
John
09/25/2022, 9:36 PMJohn
09/25/2022, 9:36 PMVampire
09/25/2022, 9:36 PMVampire
09/25/2022, 9:36 PMJohn
09/25/2022, 9:42 PMJohn
09/25/2022, 9:43 PMVampire
09/25/2022, 9:44 PMval foo by tasks.registering {
dependsOn(tasks.withType<PublishToMavenRepository>().matching { it.name == "publishMavenJavaPublicationToMavenRepository" })
}
val foo by tasks.registering {
dependsOn(tasks.named("publishMavenJavaPublicationToMavenRepository"))
}
val foo by tasks.registering {
dependsOn("publishMavenJavaPublicationToMavenRepository")
}
The first of course realizes all tasks of that type.Vampire
09/25/2022, 9:46 PMtasks.named
does not work, that is a sign that the dependee task is maybe realized a little bit early and thus the dependency is not yet registered by the plugin.
But first and third way even work with tasks.creating
and thus eager realization.Vampire
09/25/2022, 9:48 PMpublications
and repositories
containers of the publishing
extension and if either is added, the respective tasks are registered.Vampire
09/25/2022, 9:49 PMfoo
configuration before the publishing
block.
But if I move it after the publishing
block, again all three variants work fine, even with eager configuration, as then the tasks are registered already.John
09/25/2022, 9:49 PMJohn
09/25/2022, 9:49 PMVampire
09/25/2022, 9:50 PMVampire
09/25/2022, 9:50 PM