ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "McNish, Budd" <bmcn...@HealthPlan.com>
Subject RE: <target unless=...>
Date Wed, 15 May 2013 14:48:08 GMT
This works.

<project default="invalid">
  <target name="invalid">
  	 <property name="testit" value="" />
  	 <antcall target="test1" inheritall="true" >
  	   <param name="testit" value="true"/>
  	 </antcall>
     <antcall target="test2" inheritall="true" />
  </target>
  <target name="test1">
    <echo message="in test1 and value of testit is:  ${testit}"/>
  </target>
  <target name="test2" unless="testit">
    <echo message="in test2"/>
    <echo message="value of testit is:  ${testit}"/>
  </target>

</project>

C:\IBM>ant -f /temp/throw.xml
Buildfile: C:\temp\throw.xml

invalid:

test1:
     [echo] in test1 and value of testit is:  true

test2:

BUILD SUCCESSFUL
Total time: 0 seconds

C:\IBM>

Budd A. McNish

Health Plan Services
813-289-1000 ext. 2352




-----Original Message-----
From: Eric Fetzer [mailto:elstonkers@yahoo.com] 
Sent: Wednesday, May 15, 2013 10:14 AM
To: Ant Users
Subject: <target unless=...>

Hi!  I've found that my unless= is somewhat useless when using <antcall>.  Here's
a repro for what I'm trying to do:
 
<project name="test" default="testIt">
  <taskdef resource="net/sf/antcontrib/antlib.xml"/>
  <target name="testIt">
     <antcall target="test1" inheritall="true" />
     <antcall target="test2" inheritall="true" />
  </target>
  <target name="test1">
    <property name="testit" value="true"/>
    <echo message="in test1 and value of testit is:  ${testit}"/>
  </target>
  <target name="test2" unless="testit">
    <echo message="in test2"/>
    <echo message="value of testit is:  ${testit}"/>
  </target>
</project>
 
And the results that I'm sure you anticipate as you understand how antcall works:
 
[me@myMachine]$ ant -f test.xml
Buildfile: test.xml
testIt:
test1:
     [echo] in test1 and value of testit is:  true
test2:
     [echo] in test2
     [echo] value of testit is:  ${testit} BUILD SUCCESSFUL Total time: 0 seconds
 
 
My actual antcall is in a for loop using a list to call targets that start with the same word,
like so:
 
<for list="${build.apps} param="app">
   <sequential>
      <antcall target="build@{app}"/>
   </sequential>
</for>
 
Can anyone give me a better methodology for achieving the results I'm after?
 
Thanks,
Eric

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CONFIDENTIALITY NOTICE: If you have received this email in error, please immediately notify
the sender by e-mail at the address shown.This email transmission may contain confidential
information.This information is intended only for the use of the individual(s) or entity to
whom it is intended even if addressed incorrectly. Please delete it from your files if you
are not the intended recipient. Thank you for your compliance.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message