Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setup Grails project in IntelliJ IDEA

I have the following directory structure

--my-app
   |
   |--main-app
   |
   |--plugins
      |
      |--plugin1
      |
      |--plugin2

In grails-app/conf/BuildConfig I've added the necessary configuration to ensure that the plugins are loaded from the plugins directory, so that when I run the application, it picks up the most recent changes.

I'm trying to set this up as a single project in IntelliJ which has 3 modules, one for the main application and one for each of the two plugins. I tried the following:

  • Generate the IntelliJ project files

    cd my-app/main-app

    grails integrate-with --intellij

  • Open the generated .ipr file from inside Intellij (File | Open Project...). This adds the main application and plugins as Grails modules

However every time I open a class from a plugin, IntelliJ reports that the class has two occurrences. It seems each plugin class is being detected

  1. once in the IntelliJ module for the plugin itself
  2. once in the module that IntelliJ automatically creates which contains all the plugins. In my case, this module is named main-app-grailsPlugins

In the project structure view I tried removing the content roots for plugin1 and plugins2 from main-app-grailsPlugins, but they get automatically added back again.

Is there a way to prevent this, or some other way of correctly setting up an IntelliJ project for a Grails app with in-place plugins. I'm using Grails 1.3.7 and IntelliJ 10.5.4

like image 982
Dónal Avatar asked Nov 13 '22 13:11

Dónal


1 Answers

With IntelliJ IDEA 12 Ultimate this is very easy:

"File" 
    --> "Import Project..." 
         --> select your grails application, "OK" 
             --> Select "Create project from existing sources", "Next" 
                --> "Next" 
                    --> "Next" 
                        --> Select JDK, "Next" 
                             --> Select grails version, "Next" 
                                  --> "Finish"

The inplace plugins will automatically be added as modules. Result: http://d.pr/i/YHkk

like image 66
rlovtang Avatar answered Jan 27 '23 17:01

rlovtang