Grails

Grails script under cygwin does not work properly.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 0.1
  • Fix Version/s: 0.2
  • Component/s: Configuration
  • Labels:
    None

Description

This is directly from the mailing list:

I was complaining before about grails shell not being able to run
stuff under cygwin. I finally had a chance to take a look at what's
wrong there. It seems that it does the cygpath a bit too late. Here is
what it is now:

============================================================
#!/bin/sh

if [ -z "$JAVA_HOME" ] ; then
echo "Error: JAVA_HOME is not defined"
echo "Please set the JAVA_HOME environment variable and start Grails again"
exit 1
fi

if [ -z "$GRAILS_HOME" ] ; then
echo "Error: GRAILS_HOME is not defined"
echo "Please define GRAIL_HOME and start Grails again"
exit 1
fi

ANT_HOME=${GRAILS_HOME}/ant
GRAILS_ANT_CLASSPATH=$GRAILS_HOME/lib/bsf.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/groovy-all-1.0-RC-01-SNAPSHOT.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/org.mortbay.jetty.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/commons-logging.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/commons-el.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/javax.servlet.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/log4j-1.2.8.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/jasper-compiler.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/jasper-runtime.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/xml-apis.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/xercesImpl.jar
GRAILS_BUILD_FILE=${GRAILS_HOME}/src/grails/build.xml
ANT_BIN=${ANT_HOME}/bin/ant
BASEDIR=`pwd`

case "`uname`" in
CYGWIN*)
GRAILS_BUILD_FILE=`cygpath --windows "$GRAILS_BUILD_FILE"`;
GRAILS_ANT_CLASSPATH=`cygpath --windows -p "$GRAILS_ANT_CLASSPATH"`
BASEDIR=`cygpath --windows "$BASEDIR"`
GRAILS_HOME=`cygpath --windows "$GRAILS_HOME"`
;;
esac

${ANT_BIN} --noconfig -lib "${GRAILS_ANT_CLASSPATH}" -f
${GRAILS_BUILD_FILE} -Dbasedir=${BASEDIR} -Dgrails.home=${GRAILS_HOME}
$@


and here is what it needs to be (or at least I believe it should be):
===========================================================
#!/bin/sh

# OS specific support. $var must be set to either true or false.
cygwin=false
os400=false
case "`uname`" in
CYGWIN*) cygwin=true;;
esac

if $cygwin; then
JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
GRAILS_HOME=`cygpath --windows "$GRAILS_HOME"`
fi

if [ -z "$JAVA_HOME" ] ; then
echo "Error: JAVA_HOME is not defined"
echo "Please set the JAVA_HOME environment variable and start Grails again"
exit 1
fi

if [ -z "$GRAILS_HOME" ] ; then
echo "Error: GRAILS_HOME is not defined"
echo "Please define GRAIL_HOME and start Grails again"
exit 1
fi

ANT_HOME=${GRAILS_HOME}/ant
GRAILS_ANT_CLASSPATH=$GRAILS_HOME/lib/bsf.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/groovy-all-1.0-RC-01-SNAPSHOT.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/org.mortbay.jetty.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/commons-logging.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/commons-el.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/javax.servlet.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/log4j-1.2.8.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/jasper-compiler.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/jasper-runtime.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/xml-apis.jar
GRAILS_ANT_CLASSPATH=$GRAILS_ANT_CLASSPATH:$GRAILS_HOME/lib/xercesImpl.jar
GRAILS_BUILD_FILE=${GRAILS_HOME}/src/grails/build.xml
ANT_BIN=${ANT_HOME}/bin/ant
BASEDIR=`pwd`

case "`uname`" in
CYGWIN*)
GRAILS_BUILD_FILE=`cygpath --windows "$GRAILS_BUILD_FILE"`;
GRAILS_ANT_CLASSPATH=`cygpath --windows -p "$GRAILS_ANT_CLASSPATH"`
BASEDIR=`cygpath --windows "$BASEDIR"`
GRAILS_HOME=`cygpath --windows "$GRAILS_HOME"`
;;
esac

${ANT_BIN} --noconfig -lib "${GRAILS_ANT_CLASSPATH}" -f
${GRAILS_BUILD_FILE} -Dbasedir=${BASEDIR} -Dgrails.home=${GRAILS_HOME}
$@

Activity

Hide
Graeme Rocher added a comment -

Patch applied.

Show
Graeme Rocher added a comment - Patch applied.
Hide
Wayne Lund added a comment -

This is not working for me. I get the following output when I insert echos into the script.

cygwin= true
GRAILS_BUILD_FILE = c:\opt\grails-0.2\src\grails\build.xml
GRAILS_ANT_CLASSPATH = c;c:\opt\grails-0.2\lib\bsf.jar;c;c:\opt\grails-0.2\lib\groovy-all-1.0-RC-01-SNAPSHOT.jar;c;c:\opt\grails-0.2\lib\org.mortbay.jetty.jar;c;c:\opt\grails-0.2\lib\commons-logging.jar;c;c:\opt\grails-0.2\lib\commons-el.jar;c;c:\opt\grails-0.2\lib\javax.servlet.jar;c;c:\opt\grails-0.2\lib\log4j-1.2.8.jar;c;c:\opt\grails-0.2\lib\jasper-compiler.jar;c;c:\opt\grails-0.2\lib\jasper-runtime.jar;c;c:\opt\grails-0.2\lib\xml-apis.jar;c;c:\opt\grails-0.2\lib\xercesImpl.jar
BASEDIR = c:\opt\grails-0.2
GRAILS_HOME = c:\opt\grails-0.2\
ANT_HOME = c:\opt\grails-0.2\/ant
ANT_BIN = c:\opt\grails-0.2\/ant/bin/ant
ant --noconfig -lib c;c:\opt\grails-0.2\lib\bsf.jar;c;c:\opt\grails-0.2\lib\groovy-all-1.0-RC-01-SNAPSHOT.jar;c;c:\opt\grails-0.2\lib\org.mortbay.jetty.jar;c;c:\opt\grails-0.2\lib\commons-logging.jar;c;c:\opt\grails-0.2\lib\commons-el.jar;c;c:\opt\grails-0.2\lib\javax.servlet.jar;c;c:\opt\grails-0.2\lib\log4j-1.2.8.jar;c;c:\opt\grails-0.2\lib\jasper-compiler.jar;c;c:\opt\grails-0.2\lib\jasper-runtime.jar;c;c:\opt\grails-0.2\lib\xml-apis.jar;c;c:\opt\grails-0.2\lib\xercesImpl.jar -f c:\opt\grails-0.2\src\grails\build.xml -Dbasedir=c:\opt\grails-0.2 -Dgrails.home=c:\opt\grails-0.2\
eval: 1: Syntax error: Unterminated quoted string

where's the extra c; coming from? Also, when I remove it it still doesn't work.

Show
Wayne Lund added a comment - This is not working for me. I get the following output when I insert echos into the script. cygwin= true GRAILS_BUILD_FILE = c:\opt\grails-0.2\src\grails\build.xml GRAILS_ANT_CLASSPATH = c;c:\opt\grails-0.2\lib\bsf.jar;c;c:\opt\grails-0.2\lib\groovy-all-1.0-RC-01-SNAPSHOT.jar;c;c:\opt\grails-0.2\lib\org.mortbay.jetty.jar;c;c:\opt\grails-0.2\lib\commons-logging.jar;c;c:\opt\grails-0.2\lib\commons-el.jar;c;c:\opt\grails-0.2\lib\javax.servlet.jar;c;c:\opt\grails-0.2\lib\log4j-1.2.8.jar;c;c:\opt\grails-0.2\lib\jasper-compiler.jar;c;c:\opt\grails-0.2\lib\jasper-runtime.jar;c;c:\opt\grails-0.2\lib\xml-apis.jar;c;c:\opt\grails-0.2\lib\xercesImpl.jar BASEDIR = c:\opt\grails-0.2 GRAILS_HOME = c:\opt\grails-0.2\ ANT_HOME = c:\opt\grails-0.2\/ant ANT_BIN = c:\opt\grails-0.2\/ant/bin/ant ant --noconfig -lib c;c:\opt\grails-0.2\lib\bsf.jar;c;c:\opt\grails-0.2\lib\groovy-all-1.0-RC-01-SNAPSHOT.jar;c;c:\opt\grails-0.2\lib\org.mortbay.jetty.jar;c;c:\opt\grails-0.2\lib\commons-logging.jar;c;c:\opt\grails-0.2\lib\commons-el.jar;c;c:\opt\grails-0.2\lib\javax.servlet.jar;c;c:\opt\grails-0.2\lib\log4j-1.2.8.jar;c;c:\opt\grails-0.2\lib\jasper-compiler.jar;c;c:\opt\grails-0.2\lib\jasper-runtime.jar;c;c:\opt\grails-0.2\lib\xml-apis.jar;c;c:\opt\grails-0.2\lib\xercesImpl.jar -f c:\opt\grails-0.2\src\grails\build.xml -Dbasedir=c:\opt\grails-0.2 -Dgrails.home=c:\opt\grails-0.2\ eval: 1: Syntax error: Unterminated quoted string where's the extra c; coming from? Also, when I remove it it still doesn't work.
Hide
fred carter added a comment -

With respect to the "extra c:", I think this is coming from running in a "mixed mode" environment,
as we often find ourselves doing. In particular, you probably have some variables defined in the
c:/java/something format – cygwin, and/or scripts looking for it, are assuming the variables are
in "pure" unix style (/c/java/something). In the scripts above, cygpath is asked (via --path) to output
things in the form of a path, implying that the input is a path. The c:/whatever is confusing it to think
that it's a path consisting of c followed by /whatever.

I think the fix is to either use either all unix format for environment variables, or change the script to
skip the --path for things you know aren't paths. This latter is probably a local fix only.

Show
fred carter added a comment - With respect to the "extra c:", I think this is coming from running in a "mixed mode" environment, as we often find ourselves doing. In particular, you probably have some variables defined in the c:/java/something format – cygwin, and/or scripts looking for it, are assuming the variables are in "pure" unix style (/c/java/something). In the scripts above, cygpath is asked (via --path) to output things in the form of a path, implying that the input is a path. The c:/whatever is confusing it to think that it's a path consisting of c followed by /whatever. I think the fix is to either use either all unix format for environment variables, or change the script to skip the --path for things you know aren't paths. This latter is probably a local fix only.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: