-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NetBeans 9 – Exception while executing a Gradle command on old Gradle versions #377
Comments
Turns out this got fixed in version 2.0.0.2 |
This still occurs when building a Gradle project that uses older versions of Gradle (eg. 3.5 or earlier). |
This is a Gradle issue. It is actually Gradle who throws an exception and not the plugin when I try to query the Java and Gradle version via the Tooling API of Gradle. I recommend you to set a newer version of Gradle for the project (you can do that in the project properties if you do not want to change the wrapper). |
Unfortunately, the project I’m experiencing this with depends on an old plugin that requires Gradle 3 or older and trying to build it on Gradle 4 causes the plugin to break. A possible way to at least partially fix without breaking odd plugins might be to separate the version of Gradle used to execute commands and the version of Gradle used for actually using inside this plugin. |
Does running the script still requires Java 9? If not (and I would guess so, if it requires Gradle 3), then you can set platform for build scripts to JDK 8 in the project properties. |
That’s what I tried, but then the plugin tries to invoke the Tooling API from Gradle 3, which is unable to interface with Java 9 that NetBeans runs on. |
Can you try to set it in the global settings too if it helps? In Misc./Gradle/Script and Tasks |
Also, can you post the "script-platform" entry within your .nb-gradle-properties? |
Sorry, I got a bit distracted. It is not about the JDK version ... |
Doubly distracted, it is. Oh my god :) |
Knowing a real world example that this occurs in might potentially help you with solving this: |
I was not able to reproduce it regardless how I tried. I realized the your PR got merged, so I attempted to test it with the commit prior merge. Are you sure that the exception stack trace is the same as in your original report even with NB-Gradle 2.0.0.2? |
I have Here’s the full stack trace with “Prefer wrapper” checked:
And here’s trying to load it with Gradle 4.6: (ForgeGradle 1.2 is incompatible with Gradle 4+)
Building this on NetBeans 8.2 or on Travis CI which use JDK 8 works fine. |
Can you send me the content of your .nb-gradle-properties? You can remove the auxiliary and tasks tags if you want to (actually, I'm mostly interested in the script-platform part). It seems to me that the plugin is trying to set JDK 9 for the Tooling API (or does not set anything at all). I can't reproduce the issue and can't spot anything suspicious, so the only thing I can do is to ask you to do some debugging of the plugin (built from the nb9 branch) if you have the time. The wiki has some description on how to setup the plugin for debugging. The part where the plugin queries the required platfrom and sets it is in |
Here’s my entire Anyway, the <script-platform>
<spec-name>j2se</spec-name>
<spec-version>1.8</spec-version>
</script-platform> Also, if I comment out the following from
Then I can build and test the root project on JDK 9, but I can’t build the Minecraft wrappers. |
Your .nb-gradle-properties seems to be fine. So, I would guess that the problem depends on how your (or where) JDK was installed. That is, probably
Of course, the {number} parts are replaced in the logs. |
I have pushed some changes to the nb9 branch. Can you build it and check the logs? In particular, I'm interested if the message "Found no usable platforms" appears or not for you (and if so, what is the complete message). Given this issue, you would probably need to use NB 8.2 to build the plugin (otherwise it might get built using JDK 9) or set it up as described on the wiki page. |
NB-Gradle version:
2.0.0.12.0.0.2The following exception gets thrown every time I do anything with a Gradle project that uses Gradle 3.5 or older and requires executing a gradle command, on both JDK 8 and 9 projects:
The text was updated successfully, but these errors were encountered: