NetBeans-11 Can not setup for using Grails - grails

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?

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
There are no Groovy, Grails or Gradle entries on the project wizard menu (File > New Project...).
Tools > Plugins > Installed Plugins shows version 1.38 of Groovy is active, and version 1.2 of Groovy and Gradle is inactive.
The Tools > Options > Miscellaneous > Groovy tab shows that there is no Grails Home field available, as mentioned in the OP.
NetBeans 11.2 Changes
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.
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.
This is the initial version of the relevant plugins: Gradle 1.2, Groovy and Gradle 1.2 and Groovy 1.38.
Delete all three plugins. Netbeans will restart.
The Groovy tab is now missing from Tools > Options > Miscellaneous.
Select Tools > Plugins > Settings, and click the Add button, which will open the Update Center Customizer screen.
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.
Ensure that only the new entry for Grails Plugins is checked on the Settings tab, then go to the Available Plugins tab.
Select the entry for Groovy and Grails 1.34.1, and click Install. NetBeans
will restart.
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:
Creating a Grails Project
Select File > New Project > Groovy > Grails Application to create a Grails project.
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
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.
Once that is done, you can develop, build and run your Grails application in NetBeans 11.2:
Notes
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:
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.
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.
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:
Also see does netbeans 11 support grails?, although that question was for NetBeans 11.0 rather than 11.2.

Related

Why I can't create new grails application in Netbeans 8.2?

OS: Windows 10
JDK: jdk1.8.0_65
IDE: Netbeans 8.2
Steps I had taken:
1. I had installed Netbeans, selecting the ALL column, meaning it can support Groovy or the grails application.
2. I also had installed the latest version of Grails which is the grails-3.3.5.
3. After installing everything, I opened Netbeans.
STEPS I HAD TAKEN IN NETBEANS
File > New Project > Groovy > Grails Application > then I clicked next.
After that I had clicked the Configure Grails... button. Then I copy pasted the file path of my grails home directory (in my case that is C:\Program Files\NetBeans 8.2\grails-3.3.5) under the textbox of Grails Home then clicked on OK.
The problem here is that I cannot create a new project. It kept on displaying this message box: "Unexpected error occured while creating the application. See output window for more details."
And there it shows the error: "Specifiy an application name or use --inplace to create an application in the current directory"
What should I do? Please help me. I need this for my job application's exam. Thank you so much.
I get exactly the same error as you when creating a Grails 3.3.5 project in NetBeans 8.2 on Windows 10. This is because of a longstanding bug in NetBeans: Bug 258407 - Error when creating a Grails 3.1.x project, which also impacts more recent releases of Grails.
Although that bug has Status: VERIFIED FIXED, unfortunately the fix was not applied to release 8.2 itself ("...this bug is fixed in development builds not 8.2"). You have two possible workarounds:
Install a DEV build of NetBeans 8.x which contains the fix.
Install the beta release of NetBeans 9.0 which contains the fix.
Option 1: Using a DEV release of NetBeans
Download the most recent nightly Dev build of NetBeans 8.2.
Activate Groovy and locate Grails 3.3.5 in the same way as you did on NetBeans 8.2.
You can then successfully create your Grails application using the Groovy > Grails Application project wizard, and run it:
Option 2: Using a beta release of NetBeans 9.
Download and unzip NetBeans 9 beta from the Apache NetBeans 9.0 Beta web site.
Start NetBeans 9 beta and install the Groovy/Grails plugin:
Locate Grails 3.3.5 in the same way as you did on NetBeans 8.2 (Tools > Options > Miscellaneous > Groovy > Grails Home).
You can then successfully create your Grails application using the Groovy > Grails Application project wizard, and run it:

Grails Project not shown in NetBeans project window

I create a new Grails project from NetBeans but when I complete the project complition wizard, nothing to show in my NetBeans project window. My details configuration is:
NetBeans 8.0.2, JDK 8 64bit, Grails 3.0.1
I check my environment veriable setting for Java & Grails also. Everything seems ok, and one important thing is in command line when I type grails -version, it shows the version name and so on. I uninstall NetBeans, JDK, & Grails several times but same problem, I also try it for JDK 1.7 32 bit, no result. I'm used to with NetBeans, so I don't try to other IDE.
Maybe look where the project is defined on disk and open it into NetBeans.
I dont know how this case was solved, but to me it looks like the problem is still valid:
The New Project wizard (Groovy -> Grails Application) calls "grails create-app" but does not generate the nbproject directory.
My environment is:
NetBeans: 8.0.2; Grails Version: 3.0.4; Groovy Version: 2.4.4; JVM Version: 1.7.0_79
Netbeans 8.0.* does not have support for Grails 3.* projects. It can create project but cannot recognize and open the project since the project structure has been dramatically changed from Grails 2.* to 3.*. There was a task created to resolve this problem. Now it reads VERIFIED FIXED for version 8.1. So please upgrade to Netbeans 8.1.* in order to be able to handle Grails 3.* projects in Netbeans.

Grails GGTS "Task 'assemble' not found in root project" error when running "grails war" in Command Prompt

I have been learning Groovy/Grails Tool Suite (GGTS) 3.6.4, with Grails 2.4.4 using some video tutorials. When I attempt to package the project into an application using the grails war command on the Windows command prompt, I get the following error:
"Error Gradle build terminated with error: Task 'assemble' not found in root project ..."
Any references to this error that I have found online have only involved Android Studio (for instance), so I am at a loss here as to how to fix it for GGTS.
I have Android Studio 1.0.1 installed, and in case it was affecting the Grails packaging, I tried the solution of removing the <component name="FacetManager"> from the general Android Studio "MyApplication.iml" file, but that had no effect. I couldn't find any analogous file for the GGTS.
In case the issue lies elsewhere in my overall installation, I have Java JRE 7_79 (64-bit) installed, as well as the the JDK 1.7.0_79 (64-bit)
OK. I found out what the cause of the error was, and how to avoid it in the future.
The Problem
Grails 3.0.1 requires the following files for grails war to work:
build.gradle
gradle.properties
gradlew
gradlew.bat
\gradle (directory)
Grails 2.4.4 does not require any of the above files for making a WAR file.
GGTS 3.6.4 does not work with Grails 3.0.1, but it comes with and works fine with Grails 2.4.4.
The Solution
Copying the stated Gradle files & directory to a GGTS project folder fixed the problem. However, I wasn't satisfied with needing to do this manually or with a custom batch file for every project.
Looking deeper, it turns out that when working out compatibility issues between the Java 32-bit JRE existing on my system and the Java 64-bit JRE & SDK, Grails, and GGTS versions (there was a lot of fiddling to get things working), at one point I had set up my global variable to Grails to be directed at 3.0.1, and I failed to update it to Grails 2.4.4. Making this change has fixed the issue.
Explaining the Cause
When following this video series on installing a compatible set of Java, Grails, and GGTS, the instructor manually downloaded the latest version of Grails from the Grails site and then downloaded GGTS separately from its own site. Both of these were older versions than what I was working with.
In my case it turns out that, after setting up the Java SDK & Grails, the latest version of GGTS (3.6.4) did not work properly with the latest version of Grails (3.0.1). Fortunately the GGTS bundle came with an older version of Grails (2.4.4), and by referencing that, GGTS would work correctly. However, although I changed the IDE reference to Grails, I forgot to reset my environment variable ...
So GGTS was setting up the project for using Grails 2.4.4. However, when calling grails war, the command was using Grails 3.0.1! Apparently these two versions of Grails use different files for creating a WAR file, so GGTS was not setting up the project directories with the correct local files, and the packaging was failing.
Avoiding Future Occurrences
So, when using GGTS 3.6.4, make sure that all references to Grails point to Grails 2.4.4.
In general, if any GGTS bundle contains a version of Grails, you should have everything set up to use that version, even if it is old.

What is the correct procedure for upgrading a Grails project from version a.b.c to x.y.z

I have been developing Grails apps for the past five years or so, and I have yet to find a simple consistent procedure for upgrading a project between Grails versions. Typically, I wind up starting the project from scratch, painstakingly copying code from the old project into a new project, bit by bit. Tweaking along the way to get the tests to pass.
There just seems to be too many balls to juggle, from Grails versions, to groovy versions, to STS/GGTS versions. They all seem to be backwardly incompatible.
I actually work with Grails for a few years too and never had to that this way.
What I do is:
Install the new version of Grails. I use GVM for that and I highly recommend it, but it depends on your platform of choice.
Read release notes for this version and apply them. It's very important step. It often includes some Grails "built-in" plugins upgrades and so on.
Bump up the version number using grails set-version.
Update IDE settings. I use IntelliJ and it runs smoothly most of the time.
Do grails clean/grails clean-all. Remove target.
Run all tests.
Do some "smoke tests" of the application. Test the most important happy paths.
I'm afraid you might already be doing it right, but if you don't own a copy of "Programming Grails" by Burt Beckwith I suggest you buy it. There's a chapter on "Upgrading Applications and Plugins" that might help you tune your approach.
You can upgrade grails version with 5 steps
Project -> Clean
application.properties -> Change app.grails.version = (New version)
Your project -> Properties -> Grails -> Change grails installation to new grails version.
Your project -> Grails tools -> Refresh Dependencies
Run your project
I think this may be help you
If I use GGTS I do the following:
Just in case install latest Groovy compiler (2.3.x) from the STS/GGTS update site (pick Groovy Eclipse). Then select the select.
Go to Preferences Groovy -> Grails and add newer version Grails runtime. Browse to it and then once added check-mark it.
Right-click on the Grails project you'd like to upgrade. Context menu pops up. Click on Grails Tools -> Grails Command Wizard...
Select the "upgrade" command from the list and click Finish. Follow the prompts in the Console view to upgrade the project.
Now set the appropriate for the version of Grails Groovy Compiler version via the preferences Groovy -> Compiler and restart Eclipse
Fix the compiler version for the Grails project if necessary after the restart.

IntelliJ 13 New Project No Grails option

I'd like to create a new Grails project in IntelliJ 13.
I have IntelliJ 13.
I have Grails.
I do not see a Grails option in the New Project Dialog.
How do I configure IntelliJ 13 so that the New Project Dialog has a Grails option?
When I select Groovy there's an error about a missing library. Grails was installed under my home directory in ~/.grails by GVM.
Please take a look in which edition of IntelliJ you are using.
The Community edition supports Groovy, but don't support Grails;
the Ultimate edition supports Grails and a lot of Frameworks
You are selecting a wrong(java) option , you have to select groovy in left menu bar and then you will be shown grails option.
My IntelliJ New Project Dialog now has a Grails option, though I'm not sure exactly what caused it to appear.
Here are some things that I did:
On the command line, in an already existing Grails project I ran:
grails integrate-with --intellij
Then I opened the project (which involved migrating the legacy version IntelliJ project file that Grails created to IntelliJ 13)
There was a green box in the upper right corner of the project window that complained about the Grails SDK was not being configured. That box disappeared before I could click on the link inside of it to attempt to correct the problem.
I closed the project and re-opened it, in the hope of causing the green box to reappear. It did not. But a red box appeared that complained that the Java SDK was not configured properly.
In the Project Structure Dialog I configured a Java SDK.
I closed the Grails project, then I tried to create a new Grails project. This time there was a Grails option under the Groovy option.
But I think there is still issue because the dialog shows No library selected for Groovy.
Groovy is included as part of Grails, so perhaps I should click the "Create..." button and choose some Groovy installation that is packaged in the Grails installation? But, this seems like something I would expect IntelliJ to configuration automatically when it is linked to the Grails installation.
Did you enable Grails plugin in IDE? Go to File>Settings>Plugin and check the grails option, restart IDE.
Grails is only supported in the Ultimate version of IntelliJ IDEA. It isn't supported in the community edition.
You can try the Ultimate version for free for 30 days before it goes into a mode where you can only work 15 minutes until it has you stop/close whatever you're doing and reopen the IDE, I guess.
I guess you are using the community edition of IntelliJ IDEA, which does not provide any option to create a grails application. But that doesn't mean that you are not allowed to create a grails project.
Use the command line to create a new Grails project,
grails create-app YourAppName
this will create the grails app in your present working directory.
Then simply run the app using the following command
grails run-app
this will resolve all the dependencies, and start your app.
Now open the IntelliJ IDEA and load this app from your present working directory, then proceed as instructed and that's it.
Only demerit of using this technique is that suggestions and auto-completion won't work, GSP pages will be unrecognized. If you want these features then go for Ultimate Edition of the IntelliJ IDEA.
You can create a grails project via terminal (grails create-app ... ) and just import (or new -> from existing sources) project from Idea. Than you should choose "import project from external model -> gradle (or maven)". And your project is ready!
I think this will help you.
You need Ultimate version of IntelliJ not Community one in order to use Groovy/Grails.

Resources