You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ant Man <an...@yahoo.com> on 2004/04/26 17:22:30 UTC

Overriding

I am having trouble getting the ant inheritRefs to work as I would
expect it too.  I would like to set various class paths in my top level
ant file and have sub ant files be unable to change their class 
paths from what they are given.
 
Here is a small ant build script which demonstrates the idea.
I have set path1 differently in files a.xml and b.xml.  I attempt to
override the path1 so that a.xml sets the path for b.xml. Unfortunatly
in my output the two path1's are showing different output.
This is not what I expected to see.  I have been looking at this
code for several days  now and have tried many different combinations
of settings yet I can not seem to get the override to work correctly.
 
Ken
 
<?xml version="1.0"?>
<project name="a.xml" default="default">
  <path id="path1">
    <fileset dir=".">
      <include name="a.xml"/>
    </fileset>
  </path>
  <property name="print1" refid="path1"/>
  <target name="default" >
    <echo message="${print1}" /> 
     <ant antfile="b.xml" inheritRefs="true">
<!-- The next line does not seem to effect the output at all--> 
       <reference refid="path1"/>
     </ant>
  </target>
</project>

 
<?xml version="1.0"?>
<project name="b.xml" default="default">
   <path id="path1">
    <fileset dir=".">
      <include name="b.xml"/>
    </fileset>
  </path>
  <property name="print2" refid="path1"/>
  <target name="default" >
    <echo message="${print2}" /> 
  </target>
</project>

 
 
 

		
---------------------------------
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25�