views:

740

answers:

2

Hi,

I'm using IntelliJ 8.1.2 on Windows to develop a Grails 1.1 project that depends on internally developed plugins which are not available in the central Grails plugin repo. In Grails 1.1 the default location of installed plugins was moved from $PROJECT_ROOT/plugins to $HOME/.grails/1.1/$PROJECT/plugins

Using the command-line, I've installed my plugins to the default location. My IntelliJ project contains the main Grails application as a module, and in order for IntelliJ to be able to find the plugins on which the main app depends, I've added $HOME/.grails/1.1/$PROJECT/plugins as a content root and specified which are the source folders within this location.

The project builds, and I can run the tests with the IDE, but the problem I have is that the plugin projects are not setup as modules within the project - remember, it's the installed location of the plugins that's setup as a content root. So as things currently stand, if I need to change a plugin I have to do so outside the IDE, and re-install the plugin via the command-line. What I would ideally like is for the main Grails app and the plugins to be setup as modules within an IntelliJ project, but the main Grails app references the plugins from their installed location. This would enable me to change the plugins or the main app within the IDE, but the versions of the plugins that the main app depends on within the IDE would be the same as on the command-line (i.e. those in $HOME/.grails/1.1/$PROJECT/plugins). Is there any way I can achieve this setup?

Cheers, Don

+1  A: 

You can achieve this setup with 2 steps.

1) Add external plugin content at your module root

Right click on module root and select 'Module Settings'. You are on 'Sources' tab. Click 'Add Content Root' button and select $HOME/.grails/1.1/$PROJECT/plugins. Now on folder tree at right, select common folders with groovy files and mark them as 'Sources' clicking on top button. Ex.: /grails-app/[conf,services,domain...] and /src/[groovy,java..]. Now your module will recognize this sources in code suggestion.

2) Add JAR dependencies of external plugins in module dependencies

Now switch to 'Dependencies' tab. Select 'Grails User Library' and click 'Edit'. Then, for each external plugin which have jar dependencies (lib folder) you have to click 'Attach JAR Directories' and select HOME/.grails/1.1/$PROJECT/plugins/lib. Now your module recognizes jar dependencies and you can run your app with make or another tool for checking dependencies.

Hope that helps, Wans

Wanderson Santos
+1  A: 

I think this will be resolved in v8.1.3, as showed on EAP build. http://www.jetbrains.net/confluence/display/IDEADEV/Diana+EAP

Cheers, Wans

Wanderson Santos
I confirm, this is fixed in 8.1.3
HeDinges