The basic problem here is that Gradle no longer creates all tasks. Part of the rules based mechanism is the ability to not create something unless it is needed. Where it’s falling down here is that the constructs you are using don’t actually express that it is needed. Unfortunately, there’s no way right now to express that all CustomTask
objects depend on all PublishToIvyRepository
tasks. That’s what you really need. It’s coming.
Your options for right now are to:
- Call
tasks.realize()
at the end of your script to force the creation of all tasks (please note: this is an internal method) - Use naming conventions to wire things together
Example…
static class Rule extends RuleSource{
@Finalize
public void addFinalizeOnCustomTask(org.gradle.api.tasks.TaskContainer tasks){
tasks.withType (CustomTask) {myTask ->
myTask.finalizedBy { tasks.names.findAll { it.startsWith "publishIvy" } }
}
}
}