Trouble creating 1st Grails app trough IntelliJ IDEA (MacOSX)
This is the output I get when I go through the Intellij IDEA 8.0.1 (macosx) wizard to create a new app (i.e. create-app):
[/opt/local/share/java/grails/bin/grails, create-app, grails_test_project]
/opt/local/share/java/grails/bin/grails: line 3: dirname: command not found
/opt/local/share/java/grails/bin/grails: line 4: /startGrails: No such file or directory
The directory is created but the normal grails files are not included. However, creating a Groovy/Grails app at the command line works just fine. i.e. grails create-app grailis_test_project. I'm using macports as well if that's of interest. I'm also failry new to the mac so I could be missing something simple. Any help would be greatly appreciated.
macbook-pro:~ ekinsella$ echo $JAVA_HOME
/Library/Java/Home
macbook-pro:~ ekinsella$ java -version
java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)
macbook-pro:~ ekinsella$ echo $GROOVY_HOME
/opt/local/share/java/groovy
macbook-pro:~ ekinsella$ groovy -version
Groovy Version: 1.5.7 JVM: 1.5.0_16
macbook-pro:~ ekinsella$ echo $GRAILS_HOME
/opt/local/share/java/grails
macbook-pro:~ ekinsella$ grails -version
Welcome to Grails 1.0.4 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /opt/local/share/java/grails
Base Directory: /Users/ekinsella
/Users/ekinsella 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.
Anyone have any ideas on how to fix this?
Please sign in to leave a comment.
hi Eric,
If I were to guess, I would say that IDEA is not recognizing your grails GDK pointed to by GRAILS_HOME and that the script directory is pointed where startGrails can be found. We define a GRAILS_HOME environment variable inside of IDEA. if you used the app wizard to create a grails-type appiication, check the module definition to see if a Grails facet is part of it and add one pointing to your valid GDK defined by GRAILS_HOME if not. We also have a grails project library containing all GDK jars. and lastly, our first experiments with grails were using JDK 1.5.x under OSX 10.4 and found that JDK 1.6.x had less flakey behavior. if you are running OSX 10.5 on an Intel Mac there is a JDK 1.6 available. Keep in mind that Apple has not ported AWT to JDK 1.6 yet and UI technologies like GWT suffer from less than complete functionality like being able to run in hosted-mode inside of IDEA.
regards,
- Pat
That is the odd part, my project on IDEA 8.1 has the facet of grails-1.0.4. I've tired deleting IDEA's reference and remapping during a new create app senario. I always run into the same problem. I'm going to try Java 6 next. Stay tuned. Sadly, I've never had this problem on Windows (work computer XP professional). I thought it was just supposed to work on a Mac.
Sorry, I don't understand your problem. How do you create your Grails
application in IDEA? Which 'normal grails files' aren't included and
where? Which 'IDEA's reference' do you mean?
File -> New Project -> Create project from scratch (select Grails Application with project name: grailstest) -> Choose Grails SDK -> grails-1.0.4 -> Next button -> Finish button.
Only an .ipr and .iml file get created. Then the error above happens. Basically, I think it's trying to call grails create-app but something is causing the failure.
When I do this on my windows dev box the default grails file structure gets created and I can set up a run configuration and it runs fine. On my Mac OSx not so much.
Probably the problem is that you don't have JDK set up on your module to
run the grails create-app script.
That was on of the first things I checked. I've been using IntelliJ for 2 years now but never really on a Mac. Afert doing some Google searching, I'm starting to think it has more do to with how I have my enviroment variables setup and they're conflicting with IntelliJ somehow. More trial and Error to begin soon.
it has something to do with grails-1.0.4.
i've got what may be the same problem. on my mac i cannot create a grails app (get an error "Cannot Start Grails" or something) when i try to create a new grails project and specify grails 1.0.4.
it works fine if i point to grail-1.0.3.
Please ensure that your grails-1.0.4/bin/grails is executable (chmod)
found the problem....
after installing grails-1.0.4 the "grails" script in the /bin directory did not have execute permissions.
My problem ended up being a conflict of some sort. Previously, I was using an app on my MBP called Environment Variables Preferences Pane. http://www.apple.com/downloads/macosx/system_disk_utilities/environmentvariablepreferencepane.html to set my java and groovy env variables.
Grails commands at the command line worked fine but GUI apps didn't seem to pick up on Environment Variables like $JAVA_HOME or $GRAILS_HOME.
When I set the variables via .bashrc (or .bash_profile) both the command line and IntelliJ (TextMate) are now happy.
Thanks for all the help!