Grails 1.1 plugins Follow
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?
Also, I saw in another thread that there is a major problem with Grails integration in IntelliJ 8.1.2 on Windows, what exactly is this problem, and which version should I use instead (if it affects me)?
By the way, when running the tests from the command-line, I noticed that about 15% more tests fail compared to when I run them within the IDE. I realise I haven't provided much context, so don't really expect an answer, but I'm just wondering if anyone could guess why this is?
Finally, I ran my Grails tests as JUnit tests (instead of Grails tests) just to see what would happen. But now every time I run them, it runs them as JUnit tests without prompting, how can I switch back to running them as Grails tests?
Thanks in advance,
Please sign in to leave a comment.
First of all, there is a Grails Plugins dialog in IntelliJ IDEA, where
you can check and uncheck available Grails plugins. If your Grails
module is set up correctly (i.e. has Grails facet with valid Grails SDK
in it), plugin sources should be automatically added to your module on
certain events. One of them is 'Run Grails Target' action from within
IDE, please run it with any Grails command ('help' for example).
As for JAVA_HOME problem, you can use the workaround described in
http://www.jetbrains.net/devnet/thread/281832 or get
http://download.jetbrains.com/idea/idea-8.1.1.exe until 8.1.3 is released.
As for your unit tests, how do you run them from IDEA, as JUnit or as
Grails tests? They can pass if for some reasons the groovy compiler
didn't work properly and there are empty stub class files in your
output. Please try rebuild project. To run Grails tests, you may either
press CtrlShiftF10 on test class name (not method!) or create a Grails
tests run configuration manually in Run Configurations dialog. Finally,
you can use the same 'Run Grails Target' with 'test-app' command.
Thanks for the reply
I found the Grails Plugins dialog, but I don't see how I can use it achieve my goal, which is:
I don't want IntelliJ to copy the plugins from the installed location into my project. I already have the plugin modules checked out from SVN (e.g. to C:\src\plugins) and I want those copies of the plugins to be added as modules to the project, not the copies in the installed location. If you could provide step-by-step instructions on how to setup by project like this, I'd be very grateful.
I run the unit tests from IDEA as Grails tests.
You may use the Grails 1.1 feature called 'Modular application
development with plugins', like described in
http://www.grails.org/1.1-beta3ReleaseNotes. Just add
grails.plugin.location.myplugin = "c:\src\plugins\myplugin" to your
IntelliJ IDEA now doesn't offer any help for plugins used in such a way,
in 9th version it will. You should manually add the plugin sources to
your IDEA project (probably as a separate module with dependency). After
this, the project should compile and run both from within IDEA and from
Anyway, IDEA doesn't copy plugins from your home directory to the
project, it just adds paths to them to module structure, so that the
project can compile.