1

I've come back to project after a long diversion, and upgraded tooling. This means Netbeans 12.5, Java 17, Gradle 7.3… at least allegedly. For some reason, despite setting the Gradle version to 7.3, it appears to build with 7.0.

Per the image below, setting the Gradle version to 7.3 doesn't seem to be picked up. (That is immediately after hitting Apply.) It still tries to build with 7.0. And – for some indeterminate reason – it can't.

Evidence of wrong Gradle vesion being used

Restarts don't help; I can't get the configuration to be picked up. (Searches for reference to similar issues provide 5-year-old answers that are no longer relevant.) I've even tried deleting the 7.0 distribution; to no avail, it comes right back.

Can anyone provide guidance on getting this to work properly?

Rick
  • 397
  • 3
  • 16
  • [1] _"NetBeans 14.5"_ does not exist. [2] If you are referring to the most recent release of NetBeans (12.5), that was released in September, but Gradle 7.3 was only released eight days ago. [3] Why would you assume that NetBeans (or indeed any IDE, such as Intellij or Eclipse) automatically supports a product that is only eight days old? – skomisa Nov 17 '21 at 19:32
  • My bad on the NB version. As to assuming it supports it… I had no idea it was only released 8 days ago. Why would I know that? But that notwithstanding, given the constant roll of new versions of everything, I _would_ expect a natural ability to use the latest of plugins/dependencies, on the simple basis that otherwise, one ends up in a situation where the only usable, stable version of anything that can integrate with dependent tools is a patch on something three version old. – Rick Nov 17 '21 at 19:59
  • It is unrealistic and unreasonable to expect NetBeans, or any other IDE, to automatically/magically support software that did not exist at the time of its release. Sometimes it might (seem to) work. For example, adding a new JDK release as a Java Platform to NetBeans, that didn't exist at the time of its release, but that is never supported. It's safe to assume that NetBeans never supports using software that didn't exist at the time of its release. FYI, [here's a very recent example of that](https://stackoverflow.com/a/69947758/2985643) regarding NetBeans 12.5 support for Eclipse Glassfish. – skomisa Nov 18 '21 at 06:59
  • I am not suggesting supporting something that didn't exist, only newer versions. Otherwise, when A relies on B and B relies on A, it becomes impossible to ever have compatibility as each only supports an older version of the other… – Rick Nov 18 '21 at 09:28
  • OK, but with respect to your actual question Gradle 7.3 did not exist when NetBeans 12.5 was released. The onus is always on the developer to check release dates and formal support in the IDE. NetBeans 12.6 is scheduled to be released before the end of the month so when it comes out you can check whether it supports Gradle 7.3. – skomisa Nov 18 '21 at 19:49
  • FYI, although NetBeans 12.6 has still not been released, [this link details the fixes that will be included in 12.6](https://cwiki.apache.org/confluence/display/NETBEANS/Apache+NetBeans+12.6). Note that there is a section on Gradle fixes, which includes [NETBEANS-6107 Bumped Gradle Tooling to 7.3-rc-1 with Java 17 support](https://github.com/apache/netbeans/pull/3246). So hopefully you will be able to use Grade 7.3 in NetBeans 12.6 in the near future. – skomisa Nov 23 '21 at 21:11
  • Thanks @skomisa. I've been using 12.6rc3 for the last week, and 7.3 works with it. So, yes, it's looking good. – Rick Nov 24 '21 at 22:03
  • OK. Please consider posting your approach as an answer in that case, since that is more helpful to the community than having the resolution buried in the comments. I'll be happy to upvote. – skomisa Nov 26 '21 at 22:07

2 Answers2

1

Netbeans 12.6 fully supports Java 17 and Gradle 7.3. Gonfiguring the Gradle wrapper for 7.3 gets picked up correctly, eliminating all errors I was experiencing.

Rick
  • 397
  • 3
  • 16
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 28 '21 at 17:52
  • NetBeans 12.6 was released on 11/29/21. Please consider updating your answer once you have confirmed that all is well when using Gradle 7.3 on NetBeans 12.6. – skomisa Dec 08 '21 at 22:01
  • Could you please tell how you reconfigured the gradle wrapper?? I have a project dying on "Unsupported class file major version 61" and I cannot find out how to "re-initialize" a gradle wrapper. And this has plagued me for years. I hate Netbeans with gradle. – WiegleyJ Feb 01 '22 at 22:40
  • 1
    @WiegleyJ In the file system (not from within Netbeans), edit (based on the project root) `gradle/wrapper/gradle-wrapper.properties`. Change the version number in there (it's obvious). Then rebuild the project. – Rick Feb 02 '22 at 23:09
-1

Don't bother with gradle in Netbeans. It's a horrible, buggy disaster and 12.6 just seems to want to up the ante.

Netbeans does NOT support gradle in a meaningful way for normal users.

  • You now get complex multi-projects whether you want them or not.
  • When creating a Java Application you don't get a choice at what the Main class is called. It will be App with app.java and you will like it.
  • If you try to rename app.java to something useful. It will not change "Class App" to "Class Useful" it will instead change it to "ClassUsefulp". It will not rename the test file and you will be left with several syntax errors that you can have fun cleaning up.
  • No, you cannot rename the subproject itself. That will continue to be the extremely descriptive and useful "app" subproject. The IDE will not provide you a way to rename that.
  • There is no meaningful, intuitive way to create/delete/modify subprojects.
  • If your gradle version is somehow out of sync there is still no useful way to reset/recreate the gradle wrapper other than creating a whole new project and moving your source code over to the new project.
  • Oh, so you gave in and accepted the multi-project structure. You noticed that if you go through the multi-project creator GUI then you can create multiple subprojects. Yeah, good luck with that. They won't have gradle build.scripts or wrappers. You won't be able to build your awesome creation.
  • Want to use command line arguments? Forget it. There is no "run" element in the project properties. You cannot create different run configurations.
  • Want dependencies? Or any other project configuration? It's all manual editing of gradle files. There's no GUI to assist non-gradle-wizards.

Yeah. you can probably work around a lot of this by dropping to a command line shell and editing the gradle scripts/files manually and running gradle commands manually. A) you're going to need to be a gradle wizard, and B) why are you using an IDE in the first place? you've got gradle, you've got vi available. Bathe in the nostalgia because you'll have to anyways.

Do you like the idea of gradle? Do you use Netbeans? Stick with Ant, or Maven if you need external dependencies; you'll thank me later.

WiegleyJ
  • 169
  • 1
  • 8