Grails Programmer : How to open Grails 3 App with IntelliJ?

This post explains how to open a Grails 3 App with IntelliJ as described in the Grails 3 IntelliJ Quickcast by Jeff Scott Brown

Lets assume you already have a folder which contains a Grails 3 app. For example you cloned a Grails 3 project from a git repository or you created an app from scratch with the grails create-app command.

Open IntelliJ and choose Open.

IntelliJ open App

Choose the folder where the Grails 3 app is located.

IntelliJ choose folder

Go ahead and tell IntelliJ to use the Gradle Wrapper. If you do so, the IDE will use the Gradle wrapper and you will not even need to have Gradle installed.

IntelliJ use Gradle Wrapper

4 thoughts on “Grails Programmer : How to open Grails 3 App with IntelliJ?

  1. Daniel Hammer

    Hi Sergio,

    There seems to be some steps missing in the guide, between “choose folder” and “… Gradle wrapper”, I have yet to see IDEA recognize the Grails 3 project structure and support ex. integration-test, debugging etc.

    In IntelliJ IDEA 2017.3.4 (Ultimate Edition): File -> New -> Module from existing sources ->
    after i click Open and have chosen the Grails 3 module folder, I’m presented with

    – “Create module from existing sources”
    – “Import module from external model”

    Choosing “Create module from existing sources” seems to recognize the source-directories and wrappers – but I’m unable to run or debug any Grails 3 code from inside IDEA.
    (Grails 2 works as expected, except the wrapper isn’t utilized)

    Choosing “Import module from external model” and choosing Gradle enables minimal and fragile gradle-support, any Grails 3 specific code is ignored.

    I hope it’s possible to update this guide, seeing as OCI recommends IDE for Grails 3 🙂

    Reply
  2. Daniel Hammer

    @Sergio, the Guide above works fine for Grails 2, ie. selecting the root directory is crucial for getting IDEA to recognize a Grails 2 module.

    Turns out Grails detection in IDEA is a bit counter-intuitive, but if you’re aware of IDEAs quirks in this regard, it’s possible to import existing Grails modules without IDEA creating a useless mess of “modules” an “libraries” after “import”.

    But in-order to get IDEA to recognize a Grails 3 module; the build.gradle file must be selected instead – that seems to get IDEA to recognize the Grails 3 (gradle) structure and support debugging etc.

    @see https://www.jetbrains.com/help/idea/creating-grails-application-from-existing-code.html (updated yesterday upon my request for clarification)

    Best regards,

    DH

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *