[GRADLE-3126] Cannot create container element using '«name» {}' when scope owner contains `«name»(Closure)` method Created: 07/Jul/14  Updated: 08/Jul/14  Resolved: 08/Jul/14

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 2.1-rc-1

Type: Bug
Reporter: Gradle Forums Assignee: Luke Daley
Resolution: Fixed Votes: 0

Known Issue Of:



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?

Stacktrace: [1]https://gist.github.com/anonymous/f44...
gradle build files: [2]https://gist.github.com/anonymous/2f5...

[1] https://gist.github.com/anonymous/f44e7526861ef59402fd
[2] https://gist.github.com/anonymous/2f595507c284846b1f57

Comment by Gradle Forums [ 07/Jul/14 ]

Thanks for the report. I can reproduce this problem, and have simplified it to:


include 'subproject'


allprojects {
apply plugin: 'java'

sourceSets {
integrationTest {

{ srcDir file('src/integration-test/java') }


task integrationTest {
ext.ss = sourceSets.integrationTest

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.

Generated at Wed Jun 30 12:40:41 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.