How to setup the Base Directory?

Our project files are stored in a directory parallel to the sources and I cannot find how to explain that to IntelliJ (7.0.4).
For example, I have "C:\root\projects\IntelliJ7\MyApp\MyApp.ipr" and "C:\root\MyApp\grails-app\".

The result is that running grails.bat gives this error:
-


\[C:\java\libs\grails-1.0.3/bin/grails.bat, create-controller, somecontroller]

Welcome to Grails 1.0.3 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: C:\java\libs\grails-1.0.3

Base Directory: C:\root\projects\IntelliJ7\MyApp
C:\root\projects\IntelliJ7\MyApp does not appear to be part of a Grails application.
The following commands are supported outside of a project:
create-app
create-plugin
help
list-plugins
package-plugin
plugin-info
set-proxy
Run 'grails help' for a complete list of available scripts.
Exiting.
Done!
-




It looks like the project location is used as the base directory. Is there any way to override that?

Thanks,
-Cedric

0
6 comments

Yes, that it. Base directory is directory of grails-application. You can create grails application using existing sources and create controllers from this new application in IDEA

0

I tried that approach. On importing the sources IDEA detects two new facets (Spring, Grails). It then adds my project directory as a new content root, after which any grails commands I try in the IDE (create-domain-class, etc.) use the project directory as the new content root, not the existing source directory. This occurs even after I remove that directory via the module settings window.

Is there a step I've done wrong, or missed?

0

Controllers should be created in grails application i nspecial folder "controllers". Because of that any place you invoke "Create controller" will place it into "controllers" in current grails application. Which behaviour you expect?

0

Where is your .iml file located? Currently its parent directory is
assumed to be base directory for all grails scripts. We'll fix this, but
in 8.1 EAPs.

0

Yes Peter, that was exactly my problem.

The grails root directory is assumed to be the same as the .iml file.
I suppose you will introduce an option that will let the user specify a different directory.
Thanks for addressing this.

-Cedric

0

You can try the last Diana EAP and report, if current behavior satisfies
you.

There are no new options introduced, just the working directory for all
Grails command is not a module file parent anymore, but the grails-app
directory residing under the module content root. If your MyApp
directory is module content root, the problem should be fixed for you.

0

Please sign in to leave a comment.