ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "K Plummer" <kplumm...@earthlink.net>
Subject Re: How to use $ in a ANT property value
Date Sat, 05 Aug 2000 17:15:18 GMT
This does not seem to correct the problem. Here is a strippped version of
the build.xml and the ANT output of the execution.
ANT is making the evaluation of $$ same as $, or so it would appear. Is this
a problem of nesting during expansion of the
macros? From my stripped build.xml, the macro containing this macro is used
in serveral other macros.  Is ant expanding away
the preceeding $ on $$1 on the first macro (leaving $1) which becomes 1 on
subsequent macro expansions?  Can/should I preceed
with the appropriate number of $'s? That's cumbersome. With a shell script
for example,

# simple.sh
var="\$1"
for a in 1 2 3
do
eval x$a=${var}-\$$a
done
echo "x1 is" $x1
echo "x2 is" $x2
echo "x3 is" $x3

simple.sh TEST
x1 is  TEST-1
x2 is  TEST-2
x3 is  TEST-3

but perhaps I ramble

<?xml version="1.0"?>

<!-- =================================================================== -->
<!-- Initial Electronic Wagering Build Script                            -->
<!-- =================================================================== -->

<project name="electronicwagering" default="core" basedir=".">

  <!-- change this property to use a compiler other than javac. -->
  <property name="build.compiler" value="classic"/>

  <!-- The destination directory for the build -->
  <property name="ewager.build" value="../build"/>

  <property name="ewager.src" value="."/>

  <!-- The destination directory for all the compiled classes. -->
  <property name="ewager.classbindir" value="${ewager.build}/lib/classes"/>

  <property name="ewager.srcdocroot" value="${ewager.src}/docroot"/>

  <!-- The destination directory for all the web-documents. -->
  <property name="ewager.destdocroot" value="${ewager.build}/docroot"/>

  <!-- The classpath used for building the workspace. -->
  <property name="ewager.classpath"
value="${ewager.classbindir}:${j2ee.home}/lib/j2ee.jar"/>


<property name="utilmisc.classes"
value="com/youbet/ewager/services/ESocketServiceHelper$$1.class:com/youbet/e
wager/services/ESocketServiceHelper$$2.class:com/youbet/ewager/util/AspectAd
aptor$$1.class"/>

  <property name="util.classes" value="${utilmisc.classes}"/>
  <property name="all.classes" value="${util.classes}}"/>

  <property name="ewager.ejbjar" value="${ewager.build}/lib/ewagerEjb.jar"/>
  <property name="ewager.ear" value="${ewager.build}/lib/ewager.ear"/>

  <property name="ejbjar.contents" value="${all.classes}"/>
  <property name="ewager.ear" value="${ewager.build}/lib/ewager.ear"/>
  <property name="ear.contents" value="${ewager.ejbjar}"/>


  <target name="compile_classes">
    <mkdir dir="${ewager.classbindir}"/>
    <javac srcdir="${ewager.src}/com"
           destdir="${ewager.classbindir}"
    classpath="${ewager.classpath}"
           debug="on"
           deprecation="on"
     />
  </target>

  <target name="ejbjar" depends="compile_classes">
    <java classname="com.sun.enterprise.tools.packager.Main"
          args="-ejbJar ${ewager.classbindir} ${ejbjar.contents}
ewager_ejb.xml ${ewager.ejbjar}"/>
  </target>
  <target name="ear">
    <java classname="com.sun.enterprise.tools.packager.Main"
          args="-enterpriseArchive ${ear.contents} ewager ${ewager.ear}"/>
    <java classname="com.sun.enterprise.tools.packager.Main"
          args="-setRuntime ${ewager.ear} ewager_ejbruntime.xml"/>
  </target>

  <target name="core" depends="compile_classes, ejbjar" />
  <target name="all" depends="ear" />

  <target name="clean">
    <deltree dir="${ewager.build}"/>
  </target>
</project>

[I:/ElectronicWagering/src] . build.sh core
Buildfile: build.xml
Project base dir set to: I:\ElectronicWagering\src
Executing Target: compile_classes
Compiling 76 source files to I:\ElectronicWagering\build\lib\classes
I:\ElectronicWagering\src\com\YouBet\ewager\services\ejb\ESocketServiceEJB.j
ava:149: Note: The method java.lang.String readLine() in class
java.io.DataInputStream has been deprecated.
        response= m_input.readLine();
                                  ^
Note:
I:\ElectronicWagering\src\com\YouBet\ewager\services\ejb\ESocketServiceEJB.j
ava uses or overrides a deprecated API.  Please consult the documentation
for a better alternative.
1 warning
Executing Target: ejbjar

Exception during packaging:
..\build\lib\classes\com\youbet\ewager\services\ESocketServiceHelper1.class
(The system cannot find the file specified)
java.io.FileNotFoundException:
..\build\lib\classes\com\youbet\ewager\services\ESocketServiceHelper1.class
(The system cannot find the file specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:68)
        at java.io.FileInputStream.<init>(FileInputStream.java:99)
        at
com.sun.enterprise.deployment.EjbBundleArchivist.createPackage(EjbBundleArch
ivist.java:137)
        at
com.sun.enterprise.tools.packager.ComponentPackager.packageEjbArchive(Compon
entPackager.java:67)
        at com.sun.enterprise.tools.packager.Main.main(Main.java:105)
        at java.lang.reflect.Method.invoke(Native Method)
        at org.apache.tools.ant.taskdefs.Java.run(Java.java:168)
        at org.apache.tools.ant.taskdefs.Java.execute(Java.java:109)
        at org.apache.tools.ant.Target.execute(Target.java, Compiled Code)
        at org.apache.tools.ant.Project.runTarget(Project.java:675)
        at org.apache.tools.ant.Project.executeTarget(Project.java, Compiled
Code)
        at org.apache.tools.ant.Main.runBuild(Main.java, Compiled Code)
        at org.apache.tools.ant.Main.main(Main.java, Compiled Code)
[I:/ElectronicWagering/src]








----- Original Message -----
From: "Barrie Treloar" <Barrie.Treloar@camtech.com.au>
To: <ant-user@jakarta.apache.org>
Sent: Saturday, August 05, 2000 2:53 AM
Subject: Re: How to use $ in a ANT property value


> On Fri, 4 Aug 2000, Richard Landon wrote:
>
>
> > How do you avoid ANT evaluation of the $ character within a macro as in:
>
> Use $$ instead.  This should be in the documentation but it is not.
>
> e.g:
> <property name="helper.classes" value="Helper$$1.class:Helper$$2.classs"/>
>
> <target name="tryme">
> <echo message="${helper.classes}"/>
> </target>
>
> Barrie
> --
> Barrie Treloar
> ____________________________________________________________________
>
>   Barrie Treloar                      Phone: +61 8 8303 3300
>   Senior Analyst/Programmer           Fax:   +61 8 8303 4403
>   Electronic Commerce Division        Email: barrie@camtech.com.au
>   Camtech (SA) Pty Ltd                http://www.camtech.com.au
>  --- Level 8, 10 Pulteney Street, Adelaide SA 5000, Australia. ---
> ____________________________________________________________________
>
>
>


Mime
View raw message