I am running into an issue when I import a Grails project into IntelliJ IDEA. None of the dependencies are added as libraries. Everything out there says that Tools -> Grails -> Synchronize Grails Settings should be sufficient to configure the project. However, when I run that command, I get the following error:
"C:\Program Files\Java\jdk1.7.0_75\bin\java" -Dgrails.home=C:\Users\req88100\.gvm\grails\2.4.4 -Dbase.dir=C:\Users\req88100\Projects\COI_2.4.4 "-Dtools.jar=C:\Program Files\Java\jdk1.7.0_75\lib\tools.jar" -Dgroovy.starter.conf=C:\Users\req88100\.gvm\grails\2.4.4/conf/groovy-starter.conf -Xmx768M -Xms768M -XX:MaxPermSize=256m -XX:PermSize=256m -Djline.WindowsTerminal.directConsole=false -Dfile.encoding=windows-1252 -classpath C:\Users\req88100\.gvm\grails\2.4.4\lib\org.codehaus.groovy\groovy-all\jars\groovy-all-2.3.7.jar;C:\Users\req88100\.gvm\grails\2.4.4\dist\grails-bootstrap-2.4.4.jar org.codehaus.groovy.grails.cli.support.GrailsStarter --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf C:\Users\req88100\.gvm\grails\2.4.4/conf/groovy-starter.conf "idea-print-project-settings -plain-output"
|Loading Grails 2.4.4
|Configuring classpath
|Running pre-compiled script
|Script 'IdeaPrintProjectSettings' not found, did you mean:
1) SetProxy_
2) CreateMultiProjectBuild_
3) Interactive
4) ClearProxy_
5) UrlMappingsReport
Please make a selection or enter Q to quit:
I can manually add the jars to the module as libraries, but this is cumbersome. Without it, none of the code completion works correctly. That project is working correctly because grails run-app runs just fine.
This is with IntelliJ IDEA 14.1.3 on Windows 7 and several different version of Grails 2.x.x. I've tried the command manually is both Cygwin and with a standard Windows Command Prompt. Both yield that same results as IntelliJ IDEA.
There are very few Google results for either idea-print-project-settings or IdeaPrintProjectSettings. I am not sure where this script is supposed to come from.
How do I configure IntelliJ IDEA to properly pull the libraries into the module configuration?
Understanding how Grails resolves Gant scripts really helps:
http://grails.github.io/grails-doc/2.3.x/guide/commandLine.html
Grails searches in the following directories for Gant scripts to execute:
- USER_HOME/.grails/scripts
- PROJECT_HOME/scripts
- PROJECT_HOME/plugins/*/scripts
- GRAILS_HOME/scripts
The problem seems that IntelliJ IDEA is automagically providing this Gant script, but putting the script in the wrong spot.
Using VisualVM, here are the user directories:
user.dir=C:\Users\%USERNAME%
user.home=\\SOME\network\drive\%USERNAME%
So even though Cygwin, and so it seems IntelliJ IDEA, treats C:\Users\%USERNAME% as the home directory, the Windows Group Policy maps it to a network share and Java uses this value as user.home.
Looking in C:\Users\%USERNAME%\.grails\scripts, I was able to find the script. I copied it to \\SOME\network\drive\%USERNAME%\.grails\scripts and then Grails recognized the script and IntelliJ IDEA was able to configure itself properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With