newb -- import an existing grails projects into Intellij?

Hello -- I'm trying to get an existing grails project up and running within Intellij/JetGroovy.

I'm new to the IDE and I'm having a little trouble.

I've searched the forums and experimenting with the IDE -- but, can seem to figure a smooth was to get this to work? Any tips?



Permanently deleted user

Create project from existing sources pointing to your grails application. Grails facet should be detected; accept the facet suggestion, and as a result all necessary roots should be added to your project.


Hi Eugene:

What is neccessary for the facet to be detected? My grails app is not recognized, when I try to "Create Project from existing Sources"

My only option to create a grails app seems to be to run "Create Project from Scratch" which re-runs grails create-app
and creates a lot of new grails artifacts I do not want!

I am using 7.0.3.

thanks for any help!

Lee Wexler

Permanently deleted user

Hm, weird. My only guess is that you use a really old version of grails, that we do not support. In that case I think upgrading to newer version would help.


Actually, the version of grails is quite new C:\Grails\grails-1.0.1

The grails app was actually created by intellij, but the dev environment configuration files
(..iml, .ipr .iws) were not checked in.


Lee Wexler


getting somewhat the same problem here. using intellij 7.0.3, jetgroovy 1.5, grails 1.0.3.

i am having problems importing grails application with grails plugin installed (acegi plugin to be exact). what happens is that when i import from existing sources, only the acegi plugin directory is detected as valid source file, and not the enclosing grails project. to replicate:

1. grails create-app xx
2. cd xx
3. grails install-plugin acegi
4. import as existing sources to idea
5. verify that only the plugin is detected as grails project

as a workaround:
1. delete plugins directory in grails app
2. import as existing sources to idea
3. open console, cd to grails app directory
4. grails install-plugin acegi
5. back to idea, accept adding plugin to project

problem here though is that you can't do a grails run-app, and can't re-build the project due to classpath errors.


I also ran into the same problem, here's how I tried to fix it but still not ideal:
- New Project
- Create project from scratch
- Set the project file location to be your existing grails projects location
- Select project type to be "Grails Application"

This would create a grail-aware project with all your source included. However, I needed to manually add plugin library(GWT in my case) into the project setting.


Actually, I ran into this problem again yesterday when I was checking out a Grails plugin from SVN which I created. The plugin only has a limited set of grails classes/artifacts, but after creating a new IntelliJ project for it, IntelliJ ran the create-app target, which creates different classes/artifacts in comparison with the create-plugin (after creating the project, a lot of files where not under version control, even though I freshly checked out the project!)


I know this thread is more than a year old, but I thought I would add my experience with doing this same thing with Intellij 8.1.3 (build #9902) in case others have issues like I did.

I tried creating an Intellij project for an existing Grails app which I had just pulled from subversion.  I selected the "Create java project from existing sources" option.  The only way I could get the project creation wizard to detect the grails facet was to select the grails-app directory as my source directory.  I thought this was a bit odd since there is a src directory outside of grails-app and the grails-app is not itself directly a src directory (according to the definition given in the instructions in the wizard itself), but it worked.  Intellij appeared to detect and setup everything correctly, even offering to create web and spring facets.  However, when I tried to Make the project, it gave an error that I did not have a Groovy facet defined.  Okay...not sure why it didn't do that automatically if it needs one for grails, but I added it easily enough with the existing Groovy SDK I already had defined.  I tried to do a make again and it gave a compile error that it can't find GrailsUnitTestCase.  I checked the facet list again and it turns out that while Intellij created the Grails facet, it didn't actually set the Grails SDK to anything for the facet.  So I set it to the grails SDK I that I already had setup and tried to do another Make.  It still failed with the same error.

Grrr... breathe... I then tried "Rebuild Project" rather than a "Make Project".  I got another set of errors relating to a missing plugin.  This made sense.  The project had started with grails-1.0, so it has a plugins directory under the root project directory that contain a plugin.  Then the project moved to grails-1.1 and another plugin was added, this time using the new grails default of placing plugins in the user's home directory.  I used the Tools->Grails Plugins option to install that plugin.  Intellij properly downloaded the plugin into my user dir.  Unfortunately, the Intellij project and module know nothing about it.  I manually added info for the plugin to the "Grails User Library" and rebuilt.  Now everything works.

In another Grails project I have, the "Grails User Library" is updated automatically whenever I add a new plugin.  Is my current project confused because it started with a plugins directory under the root project directory itself?


Both create project from existing sources and creating new project
should work if you point them to the Grails application root directory
(parent of grails-app), which should become module content root. Please
check, if your module's content root is grails-app parent, all the
synchronization with Grails plugins should work automatically.


Exact same behavior for the project setup, unfortunately.  In the "Select Source Directory" page of the wizard, I deleted the default "src" option and clicked Next.  It prompted me if I wanted to mark the module root directory as the source directory and I confirmed that.  It then found the grails facet and spring facet as before, but it had the same problems with not configuring a groovy facet at all and not setting the Grails SDK for the grails facet it did create.  Once I fixed those and tried Make Project, I get the same problems with it not having the jars for the jsecurity plugin (the one in my userdir/.grails/.../plugins directory) in the Grails User Library.  The jars for the hibernate plugin (which is in the project-root/plugins directory) are included in the lib.

Interestingly, when I used the Tools->Grails Plugin command to try and install the jsecurity plugin again, it shows that the plugin was already enabled.  So some piece of the code is looking down the userdir/.grails/.../plugins path.  It's just not doing it at the right time to add the files there to the library.

I tried one more thing - I installed a brand new plugin using Tools->Grails Plugin.  This time the userdir/.grails/.../plugins did get added as a content element of the module and the lib directory of the jsecurity plugin was subsequently picked up. So it appears that the project creation wizard is stopping when it finds the first plugin directory under the project root.  It doesn't keep looking to see if there is also a plugin directory under userdir/.grails/... even if there are properties in the file for which there is no corresponding plugin in that first directory.


Exact same behavior for the project setup, unfortunately.

>In the "Select Source Directory" page of the wizard, I deleted the
default "src" option and clicked Next.
>It prompted me if I wanted to mark the module root directory as the
source directory and I confirmed that.
Root directory to be source directory doesn't make sense, so that may be
the cause. If you left the 'src' option, IDEA would cope with this...
This part of functionality has been reworked in Maia, so maybe you could
try the EAPs and tell if it's better now.


Sorry, I thought that's what you asked me to try.  I re-read your first message and realize you may have meant for me to check that the parent of the grails-app directory was the project root directory.  That has been the case for all setups I have tried.  The very first config I did was to leave the default "src" entry in that wizard page.  The wizard failed to detect the grails facet at all in that case.


Fast forward to 2019, and its still not possible to import a grails project (3.3.8 this time) into intellij ultimate.  It doesnt recognise that its grails, nor does it recognise gradle. I can run the app fine on the command line, I have gradle installed, gradle home set, and netbeans 9 picks it up as .a grails app flawlessly. What is wrong with intellij?


> It doesnt recognise that its grails
IntelliJ recognizes Grails 3.x projects after they are imported via Gradle.

> nor does it recognise gradle
So that must be the problem.

Please refer to