1

Using NB-8.2 In the dialog - "Tools/Options/Miscellaneous/Groovy" You could enter the location of your Grails-installation" but know with NB11 that input field is missing. I've read the question "Can not run Grails project from NetBeans" where you where suggested to remove all plugins regarding Gradle and Groovy and then reinstall them, which I tried but it didn't help.

I tried it on NB11.1 and uninstalled the following plugins: Gradle, Gradle and Groovy and Pure Groovy Project. Gradle and Grovy including "Gradle and Groovy" couldn't be uninstalled - only deactivated but the last one "Pure Groovy project" could be uninstalled. But afterwards I can not find that plugin to reinstall. So where can I find that?

Now I have installed NB11.2 but still the same problem. So where to go now?

larand
  • 773
  • 1
  • 9
  • 26

1 Answers1

2

I got this working on a fresh installation of NetBeans 11.2 under Windows 10 using Grails 3.3.11. However, there are some significant limitations because the approach essentially only recreates the Grails environment that worked with NetBeans 8.2:

Initial Status

  1. There are no Groovy, Grails or Gradle entries on the project wizard menu (File > New Project...).
  2. Tools > Plugins > Installed Plugins shows version 1.38 of Groovy is active, and version 1.2 of Groovy and Gradle is inactive.
  3. The Tools > Options > Miscellaneous > Groovy tab shows that there is no Grails Home field available, as mentioned in the OP.

NetBeans 11.2 Changes

  1. First, note that you must set JDK 1.8 as the default platform for NetBeans 11.2. See this SO answer for details on how to do that. Of course you can still create projects using other JDK versions when the default platform is JDK 8.
  2. Also note that taking the obvious step of activating Groovy and Gradle 1.2 does not help, and subsequently restarting NetBeans does not change anything, so discard that approach.
  3. This is the initial version of the relevant plugins: Gradle 1.2, Groovy and Gradle 1.2 and Groovy 1.38.
  4. Delete all three plugins. Netbeans will restart.
  5. The Groovy tab is now missing from Tools > Options > Miscellaneous.
  6. Select Tools > Plugins > Settings, and click the Add button, which will open the Update Center Customizer screen.
  7. Enter Grails Plugins in the Name field (or any other descriptive value you prefer ), and http://updates.netbeans.org/netbeans/updates/8.2/uc/final/distribution/catalog.xml.gz in the URL field, and click OK.
  8. Ensure that only the new entry for Grails Plugins is checked on the Settings tab, then go to the Available Plugins tab.
  9. Select the entry for Groovy and Grails 1.34.1, and click Install. NetBeans will restart.
  10. After NetBeans restarts, select Tools > Options > Miscellaneous and click the Groovy tab. There is now a Grails Home field available, so set it to your Grails installation:

    GrailsHome

Creating a Grails Project

  1. Select File > New Project > Groovy > Grails Application to create a Grails project.
  2. You will get this error:

    Warning |

    Unrecognized flag: non-interactive.

    Error |

    Specify an application name or use --inplace to create an application in the current directory

  3. One workaround for that is to create your Grails project from the command line using grails create-app..., then open that project in NetBeans. See this helpful SO answer for full details.

  4. Once that is done, you can develop, build and run your Grails application in NetBeans 11.2:

    GrailsWebPage

Notes

  1. After doing all the steps above, there is no Gradle entry under File > New Project..., and if you attempt to install the Gradle plugin to address that, you will get the following warning:

    InstallGradlePlugin

    Don't proceed, because reinstalling Groovy 1.38 (which you deleted in step #6 above) will prevent Grails from working. So be aware that this solution for Grails prevents you from creating freestanding Gradle projects in NetBeans 11.2 using the Project Wizard. Also, to be clear, the only plugin you should have installed to get Grails working is Groovy and Grails version 1.34.1. You do not need any other plugins containing the words "Groovy" or "Gradle" installed.

  2. I also tried creating a Grails project using Grails 4.0.1, but got the error "Could not instantiate global transform class org.spockframework.compiler.SpockTransform...". There are workarounds suggested for that error on SO. I didn't pursue them but since Grails 3.x does not work with any JDK > 8, and Grails 4.x supports JDKs > 8, you may want to pursue this issue yourself.

  3. You can download and install the "Pure Groovy" plugin from here. Although it's old, it still seems to work fine, and it will add a "Groovy Project" entry in the Project Wizard:

    GrailsProject

  4. Also see does netbeans 11 support grails?, although that question was for NetBeans 11.0 rather than 11.2.

skomisa
  • 16,436
  • 7
  • 61
  • 102
  • I want to thank you for a great answer but I'm sorry to say that it didn't work. You see, I can't uninstall any of the groovy plugins, only deacitivate them. When I did that and then added the new updatecenter for NB-8.2 nothing happends. No more available plugins appear even if I restart NB. But a funny thing is that I can add an existing project and run it without specifying what GRAILS-version to use. Of course it uses the version that the project was built on. Even version 4.01 works. But it would be nice to have GRAILS-project available from the menu. – larand Jan 29 '20 at 09:52
  • Well, it can run projects but not maintain them theres no menues for grails and if you want to create a new domain class - you can't. So why am I not able to uninstall those groovy plugins? – larand Jan 29 '20 at 18:35
  • Finally I found a working solution in this thread: https://stackoverflow.com/questions/54490958/groovy-and-grail-plugin-is-missing-in-netbeans-ide-9 – larand Oct 18 '20 at 19:08