2

I have just installed Netbeans 11.1 and when I save one of my Java files, Netbeans does not start a gradle build automatically. This used to work in Netbeans 8.2.

I have installed nb-javac and have also tried the newest Beta version to no avail.

Is this a known bug or do I need to reconfigure something when going from NB 8.2 to 11.1?

skomisa
  • 16,436
  • 7
  • 61
  • 102
ulim
  • 83
  • 10

1 Answers1

1

(This is only an explanation rather than a solution to your problem.)

First, Compile on Save is an option which is set or unset at the individual project level, rather than at the global level. So for a NetBeans Gradle project, select Properties > Build > Compile to view the setting for the Compile on Save checkbox. For that checkbox, note that:

  • It is unchecked by default, so there will not be an automatic Gradle build when you save a project file.
  • It is disabled, so you cannot trigger a build whenever you save a project file.

    GradleCompileOnSave

The problem persists in the latest beta of NetBeans 11.2.

I don't see a bug report for this issue, so perhaps you can raise one? Click the Log In button to sign up first if necessary.

That said, there is a related issue which may explain why the check box cannot be enabled. See closed bug NETBEANS-680 Erroneous Gradle Compile-on-Save activity which relates to Gradle projects using version 9.0 of NetBeans. Apparently there were spurious and unwanted compile-on-save runs being triggered even though Compile on Save was unchecked. Perhaps the feature has been deliberately disabled for Gradle projects because of that issue, though that is just speculation on my part.

Also see the GitHub page for the Gradle plugin. Comments from the NetBeans team for NETBEANS-680 suggest that the problem was with the plugin rather than NetBeans. That said, if NetBeans is offering functionality that cannot be enabled (i.e Compile on Save), it is definitely a NetBeans issue regardless of the underlying cause.

Finally, note that you can configure the Gradle plugin using Tools > Options > Java > Gradle, but I dodn't see any options there that would help with this issue.

skomisa
  • 16,436
  • 7
  • 61
  • 102
  • Thank you for your explanation and I have now created a bug report: https://issues.apache.org/jira/browse/NETBEANS-3323 – ulim Nov 01 '19 at 13:14
  • 1
    @ulim That's great. FYI, [NetBeans 11.2 is now available for download](https://www.apache.org/dyn/closer.cgi/netbeans/netbeans/11.2/netbeans-11.2-bin.zip), but your problem persists. – skomisa Nov 01 '19 at 23:15
  • I have now uninstalled Netbean's gradle support and instead installed the gradle plugin from https://github.com/kelemen/netbeans-gradle-project which does not have this bug. – ulim Nov 17 '19 at 15:39
  • I need to correct myself. The gradle plugin has the same problem. What's more, the bug persists in NB 11.3 and it looks like it will make it into the next LTS release. – ulim Mar 26 '20 at 17:39