QuickTip : Grails 2 on Cygwin doesn’t work – Error opening zip file or JAR manifest missing

Installing new version of Grails is easy. However it’s quite a pain to make it running on Cygwin. The problem is as follows:

Jdk 5 introduced “javaagent” as one of the JAVA_OPTS and it has been used in running Grails 2. Shell scripts convert $GRAILS_HOME in cygwin format for running grails. So for instance if $GRAILS_HOME is c:/grails, it becomes ‘/cygdrive/c’ in cygwin format. This makes

AGENT_STRING=-"-javaagent:$GRAILS_HOME/lib/com.springsource.springloaded/springloaded-core/jars/springloaded-core-0.8.4.jar

to something like this:

$ echo $AGENT_STRING
$ "-javaagent:/cygdrive/c/grails/lib/com.springsource.springloaded/springloaded-core/jars/springloaded-core-0.8.4.jar

which JRE doesn’t understand while executing ‘java’. It expects -javaagent value to be something like ‘c:/grails/lib/com.springsource.springloaded/springloaded-core/jars/springloaded-core-0.8.4.jar’.

To make it work, following changes need to be done in $GRAILS_HOME/bin/startGrails script:

Introduce a new variable something like GRAILS_HOME_FORWARD_SLASH before making any change to environment based $GRAILS_HOME.

# For Cygwin, ensure paths are in UNIX format before anything is touched

GRAILS_HOME_FORWARD_SLASH=`echo $GRAILS_HOME|sed 's/[\]/\//g'`

Also change the way AGENT_STRING is defined as follows:

AGENT_STRING="-javaagent:$GRAILS_HOME_FORWARD_SLASH/lib/com.springsource.springloaded/springloaded-core/jars/springloaded-core-0.8.4.jar -noverify -Dspringloaded=profile=grails"

This change lets you work with Grails 2 now on Cygwin

ShriKant Vashishtha is an enterprise Agile Coach, IT strategist, trainer, thinker and hands-on geek. He is passionate towards enterprise Agile transformation, quality aspect of software development including TDD, refactoring, Continuous Delivery, DevOps and Test Automation. He can be reached at vashishtha_sk@yahoo.com.

Tagged with: ,
Posted in Cygwin, Grails, QuickTip, Tools

Leave a Reply

Your email address will not be published. Required fields are marked *

*

CommentLuv badge

Welcome to Sampreshan
Technology Strategist, Speaker, Scrum/XP/Agile Trainer Coach and Trainer
Your interest areas
Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: