You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Fei Sha <Fe...@prism.uvsq.fr> on 2002/08/23 14:37:07 UTC

Computed ids not visible in sub projects?

Hi, all
	I have a build file like this:

----------------------------------------------------

<project name="x" default="x">

	<property name="cpid" value="classpath_id" />
	
	<path id="${cpid}">
		<pathelement location="."/>
	</path>

	<target name="x">		
		<antcall
			target="y"
			inheritrefs="true" >
		</antcall>
	</target>
	
	<target name="y">		
		<java classname="test">
			<classpath refid="${cpid}" />		
		</java>
	</target>
	
</project>

-----------------------------------------------------

E:\exmlmedia\qa>ant -f x.xml
Buildfile: x.xml

x:

y:
      [java] Reference classpath_id not found.

BUILD SUCCESSFUL
Total time: 3 seconds

The "classpath_id" is not visible in the sub project.
If I hard code the name as:

	<path id="classpath_id">
		<pathelement location="."/>
	</path>

Then it works fine. Is this intended behavior?

Another thing, when u want to see the value of a variable, u just echo ${v}
anyway similar to see what an id refers to?

Thanks!

Fei Sha


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Computed ids not visible in sub projects?

Posted by Stefan Bodewig <bo...@apache.org>.
On Fri, 23 Aug 2002, Fei Sha <Fe...@prism.uvsq.fr> wrote:

> 	<path id="${cpid}">

> 		<java classname="test">
> 			<classpath refid="${cpid}" />		

> The "classpath_id" is not visible in the sub project.
> If I hard code the name as:
> 
> 	<path id="classpath_id">

> Then it works fine. Is this intended behavior?

In a way, yes.  Properties are not expanded in the id attribute, so
your path has the literal id ${cpid}.

> Another thing, when u want to see the value of a variable, u just
> echo ${v} anyway similar to see what an id refers to?

By using a helper property and <property>'s refid attribute.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>