I am using STS(Spring source tool Suite).Is it possible to have different versions Grails project in same work-space.When i tried, they always upgraded to a more recent version of Grails.
This is certainly possible as long as both versions of grails use the same version of groovy (multiple grails installs are allowed, but only one groovy install at a time).
In your project -> Properties -> Grails, click "Enable project-specific settings". And choose the version of grails that you need.
Related
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.
I have installed GGTS 3.6.4 and also Groovy & Grails using GVM on my MAC OS.
In GGTS, Preferences - Configure Grails Installation - Add, I want to add the latest grails installed by GVM in /Users/user/.gvm/grails/current
I have also enabled the hidden folders in Mac.
grails version 3.x.x doesn't contain build.properties file.
So, you should follow the following steps:
Create /grails-3.x.x/build.properties file.
Inside build.properties write the content version name as
grails.version=3.1.1
Now, open GGTS .
Go to Window/Preferences.
Type grails in the 'type filter text'.
Select Grails.
Now click on Add button on the right panel to add grails version 3.x.x .
Select the grails version from the My computer.
You are ready to go.
Your GGTS will recognize it as now Grails installation.
According to the GGTS website, it only supports Grails 1.3/2.x (not the latest Grails 3.x). Pivotal discontinued support for GGTS earlier this year.
The best IDE alternative currently is IntelliJ IDEA. Grails 3 is built on Gradle, so no special support for Grails is necessary as IDEA already has excellent support for Gradle projects.
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.
I am using
http://spring.io/tools/ggts
for grails development. But the version that comes with this eclipse bundle is above 2.2.0. I need to change the grails version and point it to 2.2.0. I have downloaded grails version 2.2.0. How can i change the grails in the eclipse so that it points to 2.2.0? Thanks for help!
You can configure as many versions of Grails as you like inside of GGTS. Open the preferences and navigate to Groovy -> Grails. Click the "Add" button to add new versions of Grails. Now when you create projects you can select which of the installed versions you want to use. You can also associate different versions of Grails with already existing projects.
I hope that helps.
In Spring Tool Suite 3.5.1.Release , how do I set a project-specific Grails version?
I have multiple versions of Grails configured in STS.
Older versions of STS had a section called Grails in the "Properties for project" window where a particular version of Grails could be selected.
After upgrading to 3.5.1.Release I no longer see this option.
Thanks!
Since GGTS version 3.5.0 the Grails version GGTS uses now always follows the application.properties file in your project. So just change the grails version number in that file.
You may need to do some other things to actually upgrade your project to work with that newer version of Grails of course.
Please go through following step for customize your grails version in GGTS.
1) Go to Window toolbar.
2) Select Preferences.
3) Type grails on textbox and Search
you can see grails installations: where you can add and remove your different grails version. if you need to add grails version please add path of your grails version and select check box for that grails version. after adding and removing grails version you must click on OK button