Gradle Could not find method "() for arguments in root project

I have a Gradle project that I'm trying to fix, and I'm slowly learning Gradle syntax as I go.

I currently have a library that, if IS_RELEASE(an environmental variable) is set, then uploads it to our production servers. If not, he copies it to our testing location.

The code is as follows:

task(detect) << {
    if(System.getenv().containsKey("IS_RELEASE"))
        apply from: "{$rootDir}/upload-pack.gradle"
    else
        apply from: "{$rootDir}/copy-testing.gradle"
}

detect.mustRunAfter build
build.finalizedBy detect

The code looks just fine and does not cause any syntax errors in NetBeans. However, when I run gradle build, I get the following:

: compileJava UP-TO-DATE
    : processResources UP-TO-DATE
    : UP-TO-DATE
    : jar UP-TO-DATE
    : UP-TO-DATE
    : compileTestJava UP-TO-DATE
    : processTestResources UP-TO-DATE
    : testClasses UP-TO-DATE
    : UP-TO-DATE
    : UP-TO-DATE
    : UP-TO-DATE
    : FAILED

FAILURE: .

  • :
    '/path/to/ gradle/project/build.gradle': 62

  • :
    ': detect'. "() [build_934uxjujs447ej84orspcupbq $_run_closure4 $_closure15 @3a230b5f] 'myproject'.

  • Try:
    --stacktrace, . --info --debug, .

62 apply from: "{$rootDir}/copy-testing.gradle".

- ? . (. " ".)

+4
1

. , ( -) " " ( ) (ambidextrous) "s.

+5

All Articles