Wednesday 24 July 2013

Getting Apache Ant Working in Cygwin

I've just had some fun setting up Ant under Cygwin.  It all came down to getting the PATHs working correctly when the installed directories had spaces in their names.  The solution was to use cygpath to first shorten into dos format then unix-ify the paths.  e.g.

LONG_PATH=/cygdrive/c/Program\ Files/Java/jdk1.7.0_25/

DOS_PATH=`cygpath -d "$LONG_PATH"`

echo $DOS_PATH

UNIX_PATH=`cygpath -u $DOS_PATH`


So a one-liner to do the whole lot

UNIX_PATH=`cygpath -u $(cygpath -d "$LONG_PATH")`

No comments: