So we created this custom Upload task for each subproject and when gradle installToHomeDist was run it would place all the of the JAR files produced by each subproject into the GRAILS_HOME/dist directory.
Now in Gradle 2.5 it does nothing and no dist directory is created at all and no JAR files are copied. So how do we get back the previous behaviour?
So this turned out to be nothing to do with the Upload task. Instead this syntax works in Gradle 2.3 but fails in Gradle 2.5:
task install(dependsOn: subprojects.collect { Project p -> p.tasks.withType(PublishToMavenLocal)})
In Gradle 2.3 with the above defined in your root build it will execute all subproject PublishToMavenLocal tasks. In Gradle 2.5 it executes none of them.
It seems that as of Gradle 2.5 it is no longer possible to reference tasks of subprojects from the top-level project? Seems a major breaking change to me. Doing the following in the top level build.gradle prints an empty list:
What went wrong:
A problem occurred evaluating root project 'gradletest'.
> A problem occurred configuring project ':one'.
> Failed to apply plugin [id 'org.gradle.help-tasks']
> Cannot create 'tasks.help' using creation rule 'tasks.addPlaceholderAction(help)' as model element 'tasks' is no longer mutable.
No, it’s not that drastic. Do you really think we’d make such a change intentionally?
Tasks created via model rules aren’t always created like “legacy” tasks are. This is a performance optimization. Tasks are expensive to create, so we don’t want to create them if they aren’t going to be used. What’s going wrong here is that we aren’t interpreting constructs like tasks.withType() as an indication that the task is required. We can fix that.
Sorry, forgot to give more insight on your last problem.
Looks like you’re realizing the tasks too early, and after, the org.gradle.help-tasks plug-in tries to use a rule but it’s not possible anymore, because the tasks container is finalized, and not mutable anymore.
Try calling ‘realize’ just before it is needed, and also maybe reorder your plug-ins application, so that the org.gradle.help-tasks plug-in is applied before your problematic task.
Bear in mind that this is a temporary solution, until this type of constructs, between rule and non-rule world is dealt properly.