ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Landon <RLan...@youbet.com>
Subject RE: How to use $ in a ANT property value
Date Tue, 08 Aug 2000 18:35:52 GMT
The version of ANT we are using is probably the wrong version: it's the one
we got when
we downloaded the zip file from the releases section of the jakarta apache
ant link a couple
weeks back. The version does not apparently support -version!

Here some hopefully useful output.......


[C:/Jakarta-AntV1.1/bin] pwd
C:/Jakarta-AntV1.1/bin
[C:/Jakarta-AntV1.1/bin] echo $ANT_HOME
C:/jakarta-antV1.1
[C:/Jakarta-AntV1.1/bin] ls -l ${ANT_HOME}/lib/*.jar
-rw-r--r--   1 544      everyone   107769 Jul 17 10:55
C:/jakarta-antV1.1/lib/ant.jar
-rw-r--r--   1 544      everyone   132473 Jul 17 10:55
C:/jakarta-antV1.1/lib/xml.jar
[C:/Jakarta-AntV1.1/bin] ant -version
Unknown arg: -version
ant [options] [target]
Options:
  -help                  print this message
  -quiet                 be extra quiet
  -verbose               be extra verbose
  -logfile <file>        use given file for log
  -buildfile <file>      use given buildfile
  -D<property>=<value>   use value for given property

[C:/Jakarta-AntV1.1/bin] which ant
ant.bat
[C:/Jakarta-AntV1.1/bin] ant -verbose
Buildfile: build.xml does not exist!
[C:/Jakarta-AntV1.1/bin] cat ant
#! /bin/sh

if [ -f $HOME/.antrc ] ; then
  . $HOME/.antrc
fi

if [ "$ANT_HOME" = "" ] ; then
  # try to find ANT
  if [ -d /opt/ant ] ; then
    ANT_HOME=/opt/ant
  fi

  if [ -d ${HOME}/opt/ant ] ; then
    ANT_HOME=${HOME}/opt/ant
  fi

  ## resolve links - $0 may be a link to ant's home
  PRG=$0
  progname=`basename $0`

  while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '.*/.*' > /dev/null; then
        PRG="$link"
    else
        PRG="`dirname $PRG`/$link"
    fi
  done

  ANT_HOME=`dirname "$PRG"`/..

fi

# Allow .antrc to specifiy flags to java cmd
if [ "$JAVACMD" = "" ] ; then
  JAVACMD=java
fi

# Use the original tools.jar if available
if [ ! "$JAVA_HOME" = "" ] ; then
   CLASSPATH=${JAVA_HOME}/lib/tools.jar:$CLASSPATH
   CLASSPATH=${JAVA_HOME}/lib/classes.zip:$CLASSPATH
fi


CLASSPATH=${ANT_HOME}/lib/xml.jar:$CLASSPATH
CLASSPATH=${ANT_HOME}/lib/ant.jar:$CLASSPATH
CLASSPATH=${ANT_HOME}/lib/moo.jar:$CLASSPATH
export CLASSPATH

$JAVACMD -Dant.home=${ANT_HOME} org.apache.tools.ant.Main $@

-----Original Message-----
From: Stefan Bodewig [mailto:bodewig@bost.de]
Sent: Monday, August 07, 2000 11:41 PM
To: ant-user@jakarta.apache.org
Subject: Re: How to use $ in a ANT property value


Which version of Ant are you using? For current CVS:

bodewig@sbodewig /tmp >cat > build.xml
<project name="test" default="tryme" basedir=".">
<property name="helper.classes" value="Helper$$1.class:Helper$$2.classs"/>

<target name="tryme">
<echo message="${helper.classes}"/>
</target>
</project>
bodewig@sbodewig /tmp >ant
Buildfile: build.xml

tryme:
Helper$1.class:Helper$2.classs

BUILD SUCCESSFUL

Total time: 0 seconds
bodewig@sbodewig /tmp >ant -version
Ant version 1.2alpha compiled on August 8 2000

I get the expected result - and the code that does the ${} expansion
(and handles the $$ case) didn't change since Ant 1.1 IIRC.

Stefan

Mime
View raw message