ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kusumoto, Kris" <kkusum...@learningframework.com>
Subject Property Replacement and Custom Tasks
Date Wed, 03 Oct 2001 16:27:30 GMT
After upgrading from 1.2 to 1.4 one of my custom tasks quit working.  After
some testing, I narrowed the problem down to an unexpected difference in
property replacement between built-in tasks vs. custom tasks.

The build.xml below is a minimal example which doesn't use my custom task
but still illustrates the issue.  The custom task 'testcall' maps to Ant's
CallTarget (i.e. antcall).  I would expect both calls to the 'test' target
to operate the same, but they don't.  Am I mis-using property replacement?

Kris


BUILD.XML
---------------------------------------------------------------
<project name="unused" default="all" basedir=".">

   <target name="all">
     <property name="bad" value="good" />
     <taskdef name="testcall"
classname="org.apache.tools.ant.taskdefs.CallTarget" />
     <antcall target="test">
        <param name="arg" value="${bad}" />
     </antcall>
     <testcall target="test">
        <param name="arg" value="${bad}" />
     </testcall>
   </target>

   <target name="test">
      <echo message="test is ${arg}" />
   </target>

</project>

OUTPUT
----------------------------------------------------------------
Buildfile: build.xml

all:

test:
     [echo] test is good

test:
     [echo] test is ${bad}

BUILD SUCCESSFUL

Total time: 0 seconds

Mime
View raw message