Gradle 2.14-rc-5 method not found error on Windows


(Peter Feichtinger) #1

Gradle Version: 2.14-rc-5 (since 2.14-rc-1)
Operating System: Windows 7 x64
In Gradle 2.13 there’s a different error (see below).

I get the following error when trying to run the linked script with any Gradle 2.14-rc version:

Execution failed for task ':tasks'.
> Exception thrown while executing model rule: repositories { ... } @ build.gradle line 7, column 5
   > Could not find method findJdkIncludePath() for arguments [] on object of type org.gradle.nativeplatform.internal.prebuilt.DefaultPrebuiltLibrary.

This only happens on Windows, on Linux the script runs fine. Also, there’s a second version of the “missing” method at the bottom, which is indeed found and produces no error.

The script:

In Gradle 2.13 I also get an error, but this time it can’t find method libs(), maybe that’s related somehow:

Execution failed for task ':tasks'.
> Exception thrown while executing model rule: repositories { ... } @ build.gradle line 7, column 5
   > Could not find method libs() for arguments [interface org.gradle.nativeplatform.PrebuiltLibraries, build_2zehrrx8b98g1te5erd6gviym$_run_closure1$_closure2$_closure4@4b4ee511] on root project 'repo'.

(Sterling Greene) #2

In your findJdkIncludePath() method, there’s no such resolve method that takes two Strings.

That’s what you’re doing on this line: return programFilesJava.resolve("jdk${javaVersion}", "include") The method is throwing a MissingMethodException that’s hidden.

You can see this error if you just do println findJdkIncludePath() in the outer most script block.

I think this has to do with the way we look up dynamic properties and methods with Groovy (that rely on exceptions for control flow). I raised GRADLE-3479. This is unlikely to be fixed in 2.14.


(Peter Feichtinger) #3

Well that’s embarassing, I thought resolve took a number of Strings :grin:

Thanks for the help!