27

I feel like I'm missing something simple at this point. I upgraded to grails 2.1.1 from 1.3.7 while running IntelliJ 10, recently I upgraded to IntelliJ 12 and imported all settings. Somehow in the project in IntelliJ 12, I have no grails SDK.

My Global Library has grails 2.1.1 defined with all the correct .jars included, however, the Tools menu is missing the "Grails" sub-menu, and attempting to run the app gives the error message that Grails SDK is not configured.

If I create a new project for grails, the SDK configures correctly and Grails shows in the Tools menu. What am I missing preventing me from adding the Grails SDK to this project? Thank you, community, for your time and suggestions.

Trebla
  • 1,164
  • 1
  • 13
  • 28

8 Answers8

50

You do not have to create a new project.

Had the same problem, and it took me quite some search to resolve it:

  • right click your Grails module
  • click "Add framework support"
  • select "Groovy"
  • The dropdown next to "Use library" will allow you to choose a grails library.
  • If the dropdown is empty press "create" and choose your grails library directory.
  • Grails SDK is configured then

Add framework support

select grails library

Community
  • 1
  • 1
peterp
  • 3,101
  • 3
  • 22
  • 37
  • +100 for that, I couldn't find that without help. Thak you very much!!! – IgniteCoders Oct 09 '19 at 11:44
  • Trying to add grails library to groovy module, but none of my grails lib folder selection is accepted by intellij 2020.1...which is the grails lib that IJ can accept for grails support? – Stefano Scarpanti Apr 17 '20 at 12:42
11

With Intellij 16 right click on your project in the right hand project pane.

Choose Grails->Configure Grails SDK.

If you're using the grails wrapper I would point to that SDK:

/Users/your user/.grails/wrapper/2.5.2/grails-2.5.2

thepner
  • 479
  • 3
  • 13
6

I found a symlink that points to the latest version in:

~/.sdkman/candidates/grails/current

I'm using SDKMAN 4.0.37

Pointing Intellij at that location will allow you to switch versions using sdkman.

The Ludz
  • 61
  • 1
  • 1
5

I have the IntelliJ 12 too, to run app i just click in 'File' -> 'Create Project', select 'Grails Projectenter image description here'

Click Next,

enter image description here

Click em Create, select the folder, who contain the Grails 2, and Voila. :-)

If you has the project before, run in project 'grails integrate-with --intellij' or run import project, and create a Grails SDK

1

Not really an "answer" here, but after seeing similar troubles with IDEA I went ahead and just created a new project and copied my source in and resolved my issues, if not solving the actual problem.

Trebla
  • 1,164
  • 1
  • 13
  • 28
0

I am working with IntelliJ 12.0.1 ultimate. I have installed Grails 2.3.1 on my computer, but always got errors when trying to specify it as a Grails SDK- "failed to create library. Looks like Grails distribution in specified path is broken. Cannot determine version." I tried with Grails 2.3.0, but got the same error. Then, I tried my luck with Grails 2.2.4, and I could finally get it work.

0

Creating a New Project will actually not overwrite any existing code; just point it at your existing project directory, select Grails and open it up.

Your project will now complain that there is no Grails SDK; just point it at your Grails dist and you are good to go.

durp
  • 198
  • 1
  • 6
0

Recently, I've encountered a similar type of issue. I have the grails SDK folder, but OK Button not enabled when trying to configure from the project. Then we have installed the Grails Plugin in IntelliJ. Then OK Button enabled and grails SDK is configured into project.