IntelliJ 11 - Grails SDK is not configured - grails

I have recently upgraded my IntelliJ 10 to the latest 11.0.1 version. I am writing grails app and until I was using the older version of IntelliJ everything was fine, however 11 doesn't allow me to successfully add Grails SDK (2.0.0) - I was trying to add the framework support, this however doesn't seem to be persisted (after adding Groovy and then choosing Grails - nothing happens). I have tried to follow those steps as well: IntelliJ IDEA 9.0 - unable to select project SDK for Grails application
I would be grateful if someone would be able to point me how to configure Grails SDK - or what could be wrong in my configuration.
Thanks,
This is exactly the way that I have my global library defined and still I was having exactly the same issue.
I followed OverZealous advice and created a new Grails project named exactly the same as the original one and boom everything is fine now! Thanks for help.

You don't need both Groovy and Grails for Grails project, just use Grails SDK. When creating a new Grails project there is an option to add new SDK, select the home path of your Grails installation and it will be configured automatically as a Global Library and this library will be added as a dependency to your module.
Grails library configuration contains all the jars from GRAILS_HOME\dist and GRAILS_HOME\lib, plus all the jars from the src directory.
In other words, it's not configured as a framework, it's just a library with all the jars from Grails distribution added to the module dependencies.

Each time I restart IntelliJ, version 13.1.2, it loses the SDK configuration. If I right-click on the project and "Add Framework Support" I can choose the SDK that is already configured and it will begin functioning properly. When it loses this setting, it won't allow me to compile or launch the app with grails. I reject the ideas to recreate the project, (been there/done that) as I have many dependent modules I have to verify and I lose all my run configurations that I've setup manually.
I'm posting the "Add framework support" step here so it might help someone else; hopefully a more permanent solution for you, but its temporary in my situation

Related

Grails 3.0 support in NetBeans

I was running Grails 2.2.0 in NetBeans and it was working fine. I tried to upgrade the project to Grails 3.0 but after creating the project NetBeans is not able to open the project.
Does anyone know which plugins to install in NetBeans (if available) to make Grails 3.0 work?
Just wanted to let you know that I've added initial support for grails 3 in NetBeans.
https://netbeans.org/bugzilla/show_bug.cgi?id=254405
At the moment you can get these with the latest NetBeans nightly: http://bits.netbeans.org/download/trunk/nightly/latest/
This will allow NetBeans to recognise/create projects, and the create controller/domain/etc actions working.
One important thing still missing is adding support for the gradle build files (no syntax highlighting or helpers for the gradle files), but in the meantime you may try it and report problems/improvements.

Errors when upgrading a Grails Project Groovy\Grails Tool Suite

I'm trying to run a Grails Application from the Grails In Action website. I've imported the 'hubbub' project into the GGTS app and have encountered build errors. The project was originally built with Grails 2.3.7 whereas I have version 2.4.4 on my system. Based on another Stack Overflow question I've changed the 'app.grails.version' in the application.properties file to grails version 2.4.4 which prompted a flurry of downloads in the command prompt terminating in a series of errors regarding problems with plugins. I can't run the app because I'm told that "Project 'hubbub' is missing required source folder: grails-app/utils". If I try to change 'app.grails.version' back to 2.3.7 I'm told that I need to configure a Grails installation of 2.3.7.
Am I doing something wrong here in trying to upgrade this Grails project? Or do I really have to install Grails 2.3.7 in order to get this to work?
(Sorry, I haven't posted the errors regarding plugin downloads but I can't seem to recreate them).
Thanks in advance!
Grails 2.4 is a big change over 2.3, mostly due to the use of the asset pipeline instead of resources.
Also simply changing the version in application.properties isn't enough, you also need to actually run the matching Grails framework.
See here for upgrading an app from 2.3 to 2.4: http://grails.github.io/grails-doc/2.4.x/guide/upgradingFrom23.html . From experience upgrading Grails apps from older versions must be done manually. One reason is that the upgrade command is obsolete and has been removed. Read the docs for breaking changes and address each change individually in the code. Upgrading patch levels are no problem (usually), but upgrading minor and major versions often are a lot of work.
Since you are learning, I would stick to 2.3.7 for your exercise (meaning that you must run 2.3.7, which you aren't doing). What you'll learn will remain valid. Do use 2.4.4 when building your own project from scratch.
If your project only missing grails-app/utils, try just to create it.
Take a look in your Project Properties -> Build Path. There are all the source folder defined. It can be helpful

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.

IntelliJ 12.0.1 - Grails 2.3.X Distribution in specified path is broken

I am struggling to configure grails 2.3.X in IntelliJ idea 12.0.1. Grails 2.2.X is configured successfully.
Grails 2.3.2 is working properly from terminal. I can compile, test, run my application. But while trying to configure it in IntelliJ so that dependencies get resolved, I get the IntelliJ shouting straight to me(as pictured below).
Looks like Grails Distribution in specified path is broken. Cannot
determinate version.
What I see is changes in grails-2.3.x/dist/ to earlier version's grails-2.2.x/dist/.
Is this because there's no support for newer version(2.3.x) of grails in IntelliJ 12 or what ?
I want nothing else but my application (jar) dependencies to be resolved in the IDE.
Make sure you are running the latest version of IntelliJ IDEA - v12.1.6. There was a "Grails 2.3.0 not working" bug fixed in 12.1.6.
You may also want to take a look at the Grails SDK is not configured question. One of the IntelliJ IDEA developers has a detailed answer in that question that may help.
Also, this thread on the IntelliJ IDEA forum may be useful.
For Information to reload the dependencies in IntelliJ 12.1.6 , following path works fine.
Tools
-> Grails
-> Synchronize Grails settings

creating a Grails application in IntelliJ IDEA 9.0.x fails to prompt for "create-app"

When I create a Grails application in IntelliJ 9 on Snow Leopard I am not prompted to create an application. IntelliJ finished the wizard and creates an empty project that is not a Grails application. I have tried two different Apple computers (MacBook Pro and Mac Pro) it does not work on either. The same steps on a Linux system results in a prompt to "create-app" and a Grails application.
I have already tried the steps in Intellij IDEA setup on OS X
Is there a specific place that Grails needs to be installed? Has anyone else seen this behavior?
Thanks
Answer: Make sure that the grails directory is writable.
Just tried this on Snow Leopard running Intellij 94.633 (EAP) + grails 1.2.1 and the create new project wizard has worked just fine.
Started with 'create new project', selected a grails module, was then prompted to 'create-app' or 'create-plugin' and was presented with a completed project.
Might be an idea to try the same EAP build if no joy you will have to file a bug with jetbrains. They are pretty good at responding to issues, you should get some sort of feed back pretty soon.
This is actually the first time I've actually done that in intellji, previously I've always just used the grails command line and then just imported the application to Intellij.
Make sure that the grails directory is writable.
I moved my grails install from /opt/grails-1.2.1 to /Users/dave/grails-1.2.1 and I can now create or import grails applications.

Resources