I'm on Ubuntu (14.04) and just installed the latest version of GVM (1.3.13). I then used it to install Grails (2.3.7), Groovy (2.2.2) and Gradle (1.11).
Groovy and Gradle seem to have installed perfectly fine (I can execute their SDK commands, such as groovyc, etc.). But whenever I execute any Grails command, from any directory, my entire terminal's screen clears, pauses for a second, and then re-draws my command line prompt. The command never gets executed. Several months ago, on Nabble, another user reported a very similar issue.
From the shell, if I execute echo $GRAILS_HOME, I get:
/home/myuser/.gvm/grails/current
If I ececute echo $PATH I do see that /home/myuser/.gvm/grails/current/bin is on my system path.
So then I decided to dig deeper and actually go to $GRAILS_HOME. It's a symbolic link actually pointing to /home/myuser/.gvm/grails/2.3.7. So when I go there, I see a normal Grails installation, including a bin directory. When I drop into that bin dir, I see:
grails-debug
grails.bat
grails-debug.bat
startGrails.bat
startGrails
grails
I open grails (a shell script) and see:
#!/bin/sh
trap "reset" EXIT
trap "reset" INT
trap "reset" TERM
DIRNAME=`dirname "$0"`
. "$DIRNAME/startGrails"
startGrails org.codehaus.groovy.grails.cli.GrailsScriptRunner "$@"
I modified this as follows:
#!/bin/sh
trap "reset" EXIT
trap "reset" INT
trap "reset" TERM
echo "1..."
sleep 2s
DIRNAME=`dirname "$0"`
echo "2...dirname is $DIRNAME"
sleep 8s
. "$DIRNAME/startGrails"
echo "3..."
sleep 2s
startGrails org.codehaus.groovy.grails.cli.GrailsScriptRunner "$@"
And then saved/exited and ran grails help from the shell. Here was my output:
1...
2...dirname is /home/zharvey/.gvm/grails/current/bin
The last line of output ("2...dirname is...") pauses for 2 seconds, and then my screen clears (as if I had issued a clear command) and my prompt re-appears. At no point in time does my actual command (grails help) actually execute or generate output. So it seems that the exact line where the bug exists is:
. "$DIRNAME/startGrails"
What is this line even doing, and why would it cause the script to fail?
I had a similar problem and my problem was that I had set the JAVA_HOME variable incorrectly. Although JAVA did work on my machine but was set like :
JAVA_HOME=/usr/lib/jvm/jdk1.8.0/bin
export JAVA_HOME
PATH=$PATH:$JAVA_HOME
export PATH
Clearly, when I looked at it more closely, I found out my mistake and set the above as:
JAVA_HOME=/usr/lib/jvm/jdk1.8.0
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH
Just a subtle difference, but it did work correctly now and the command
grails
did not fail silently as explained above.
Hope it helps !!
I figured this out with a bit of (very painful) debugging.
In GRAILS_HOME/bin/startGrails (a POSIX script) there is a line that checks to see if JAVA_HOME is set correctly.
I did not install my JDK the recommended way. I don't like using apt-get to configure Java for me. I like to download the JDK myself and add JAVA_HOME to the PATH myself. This was the root of the problem.
Since JAVA_HOME wasn't set up correctly on my Ubuntu machine (because I chose the manual/discouraged approach over the apt-get method), the startGrails script was failing (silently mind you, c'mon Grails team...) because it couldn't access JAVA_HOME:
if [ -z "$JAVA_HOME" ] ; then
die "JAVA_HOME environment variable is not set"
So I just changed this to:
if [ -z "$JAVA_HOME" ] ; then
export JAVA_HOME="<value of my $JAVA_HOME var as defined in ~/.bashrc>"
I'm going to leave this up since I'm clearly not the only person encountering this.
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