You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jon Schewe <jp...@eggplant.mtu.net> on 2000/11/27 00:26:35 UTC

allow one to pass a classpath to ant

The way that the current ant scripts are setup it's pretty hard to pass in a
classpath to ant and I really don't like setting environment variables to
project specific settings, so I modified the ant shell script as follows:

At the end of the file put the following, just above the execute command and
change the execute command to use $args instead of $@.
#allow someone to add to the classpath
args=""
for arg in $@; do
  echo $arg
  if [ $arg = "-classpath" ]; then
    set grabarg=grab
  elif [ -n $grabarg ]; then
    LOCALCLASSPATH="$LOCALCLASSPATH:$arg"
    unset grabarg
  else
    args="$args $arg"
  fi
done

$JAVACMD -classpath $LOCALCLASSPATH -Dant.home=${ANT_HOME} $ANT_OPTS org.apache.tools.ant.Main $args

Thought someone else might find this handy.  I haven't figured out how to do
this to the batch file too though.

-- 
Jon Schewe | http://eggplant.mtu.net/~jpschewe
For I am convinced that neither death nor life, neither angels 
nor demons, neither the present nor the future, nor any 
powers, neither height nor depth, nor anything else in all 
creation, will be able to separate us from the love of God that 
is in Christ Jesus our Lord. - Romans 8:38-39
NOTE: My first name has no 'h' in it!  Please be observant.