I’m testing gradle 2.0 with our multiproject build, and it gets stuck when applying the integrationTest pattern with the error “Could not find method integrationTestCompile”. The funny thing is, that with subprojects{} instead of allprojects{} it seems to work fine. Is this a bug or am I missing something?
With Gradle 1.12, running ‘gradle help’ works fine. With Gradle 2.0, the error message is:
* What went wrong:
A problem occurred evaluating root project 'mp'.
> Could not find property 'integrationTest' on SourceSet container.
Changing ‘allprojects’ to ‘subprojects’ works as well.
I think the issue is due to the task name and sourceSet name being the same. If you change the name of the ‘integrationTest’ task (or the sourceSet), the problem is resolved.
<br /> methodInSimpleDomainObject called for object 'repositories' <br /> Objects in container: [repositories] <br />
Executing it in Gradle 2.0:
<br /> Build file 'build.gradle' line: 19 <br /><br /> * What went wrong: <br /> A problem occurred evaluating root project 'closurebinding'. <br /> > Could not find method methodInSimpleDomainObject() for arguments [] on repository container. <br />
This only occurs if the name of the domain object is a method in an enclosing closure delegate (like in this case the project). This is pretty suprising.
Even more surprising: If you omit the call to methodInSimpleDomainObject, both versions yield the same result. But then there is no object created in the container!
<br /> Objects in container: [] <br />
I see, why the new behavior in Gradle 2.0 is more reliable than the behavior in 1.8. I’m still not convinced however, why one would want to call a configure-method, i.e. a method call with a single closure parameter, onto an object in some outer scope instead of creating a new object in the directly surrounding container.
Maybe you can reconsider and give the delegate precedence over the owner for all closure-like methods. If not, you should at least document this as potential breaking change in Gradle 2.0, as it is very hard to find and investigate.