Grails 1.1 project setup

Hi,

I'm wondering what's the best way to setup a Grails 1.1 project in IntelliJ 8.1.2 that has plugin dependencies installed in the new default location (under $HOME/.grails not in a /plugins directory within the main project)? My current project was setup as follows

  • File -> Project Structure
  • Modules -> Add Content Root -> $HOME/.grails/1.1.1/projects/$PROJECT/plugins
    • Set the source dirs for the project and the plugins
  • Dependecies -> Add the "Grails User Library" library if it doesn't already exist
  • Attach Jar Directories -> Add the  project lib directory and all plugins libs directories


Although this works, it seems like a lot more work than it should be. The project's application.properties file already defines the plugins that I depend on, so I feel like I shouldn't have to manually add all the plugin source dirs and libraries. Also it seems wrong to be adding the plugin source folders to the project, because I don't particularly want to debug into or compile the plugin source code, I just want them to treat them as dependencies, just like the jars in the main project's lib folder. However, this was the only way I could find to get everything compiling within the IDE. Is there a better/easier way?

Despite these complaints, IntelliJ is still the best IDE for Groovy/Grails development.

Cheers,
Don

0

Please invoke 'Run Grails target' from within IDEA. It should help.
We'll try to perform the same operations automatically in next 8.1.x
EAPs/releases.

0

We'll try to perform the same operations automatically in next 8.1.x
EAPs/releases.

Done. 8.1.3 next EAP. BTW Maia has it already.

0

Thanks for the reply. Are you suggesting that I can replace all the plugin setup steps I've described above with "Run Grails Target". In other words, do I need to do anything in addition to:

  • Open main project
  • Run Grails target


Also, does it matter which target I run? Would "clean" be sufficient, for example?

0

Thanks for the reply. Are you suggesting that I can replace all the plugin setup steps I've described above with "Run Grails Target". In other words, do I need to do anything in addition to:

  • Open main project

  • Run Grails target


Also, does it matter which target I run? Would "clean" be sufficient, for example?

This should be sufficient. Even 'help' should be sufficient, in fact.

0

I tried using "Run Grails target" to configure the project and it seems to automate many of the steps I've been performing manually. One of the things it does is add a module library named "Grails User Library". This includes the various Grails JARs, but does not include the Groovy JARs. Therefore, when I try to build the project I get an error dialog that says:

Cannot find Groovy home for module 'myModule'.

Please set up Groovy facet.

I checked the facets in the "Project Structure" dialog, and both the Grails and Groovy facets exist, though only the Grails facet has been added to myModule. There doesn't appear to be any way of adding the Groovy facet, though perhaps this is because myModule already has the Grails facet (which implies the use of Groovy). Maybe all I need to do is specify the location of GROOVY_HOME or setup a Groovy library. If so, could you please provide instructions?

The only way I can get my project to build is by creating my own global library - which includes the Groovy and Grails JARS - and adding it to the module. However, this setup prevents me from using the "Run Grails Target", because every time I use this feature it adds the aforementioned "Grails User Library" to the module, which duplicates many of the dependencies in my global library.

Thanks in advance,
Don

0

Grails user library contains the jars from your /lib directory and your
plugins /lib directories. But groovy*.jar is included into Grails
distribution, and should be part of your Grails module library aka
Grails SDK. If this is not true, you could try to remove and add Grails
SDK again pointing to a directory with a Grails distribution which
contains groovy*.jar. IDEA should then automatically pick that jar
amongst others and add to Grails* SDK.

0

Thanks for the reply. Can you tell me where in IDEA 8.1.2 I can re-install the Grails SDK? I've searched through all the settings, and can't find the releveant screen.

0

Grails SDK is in fact a project or global library. You can search for it
in corresponding places and remove it from there. Reopen the settings
and re-add it in Grails facet settings.

0

请先登录再写评论。