You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2003/08/25 11:29:54 UTC

DO NOT REPLY [Bug 22690] New: - Inheritance of nested in broken

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22690>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22690

Inheritance of nested <reference> in <ant> broken

           Summary: Inheritance of nested <reference> in <ant> broken
           Product: Ant
           Version: 1.5.3
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: mattiasb@bea.com


Seems like the imutability rules of nested <reference> elements in the <ant> 
task does not work like they should (and are documented to work). From the 
documentation of the <ant> task:

Nested <reference> elements can also be used to copy references from the 
calling project to the new project, optionally under a different id. References 
taken from nested elements will override existing references in the new project.

But given the two files pathref_1/2 (see below) we get:

C:\Work\View\example\src>c:\Tools\apache-ant-1.5.3-1\bin\ant -v -f pathref_1.xml

Apache Ant version 1.5.3 compiled on April 16 2003
Buildfile: pathref_1.xml
Detected Java version: 1.4 in: C:\Tools\j2sdk1.4.1_03\jre
Detected OS: Windows XP
parsing buildfile pathref_1.xml with URI = file:C:/Work/View/example/src/pathref
_1.xml
Project base dir set to: C:\Work\View\example\src
Build sequence for target `pathref_2' is [init, pathref_2]
Complete build sequence is [init, pathref_2]

init:
     [echo] Path = C:\Work\View\example\src\monkey

pathref_2:
      [ant] calling target [default] in build file C:\Work\View\example\src\path
ref_2.xml
parsing buildfile C:\Work\View\example\src\pathref_2.xml with URI = file:C:/Work
/View/example/src/pathref_2.xml
Project base dir set to: C:\Work\View\example\src
Build sequence for target `init' is [init]
Complete build sequence is [init]

init:
Overriding previous definition of reference to path.id
     [echo] Path = C:\Work\View\example\src\business

BUILD SUCCESSFUL
Total time: 1 second

So, references taken from nested elements will _not_ override existing 
references in the new project. Same problem exists in 1.6.alpha from 08/24.

pathref_1.xml:
<project name="pathref_1" default="pathref_2">
	<target name="init">
		<path id="path.id">
			<pathelement location="monkey"/>
		</path>
		<property name="path.property" refid="path.id"/>
		<echo message="Path = ${path.property}"/>
	</target>
	
	<target name="pathref_2" depends="init">
		<ant antfile="pathref_2.xml" inheritall="false" 
inheritrefs="false">
			<reference refid="path.id"/>
		</ant>
	</target>
</project>

pathref_2.xml:
<project name="pathref_2" default="init">
	<target name="init">
		<path id="path.id">
			<pathelement location="business"/>
		</path>
		<property name="path.property" refid="path.id"/>
		<echo message="Path = ${path.property}"/>
	</target>
</project>

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