ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From WebServices Development <WebServices_Developm...@csx.com>
Subject RE: How to use a variable value in ANT refid
Date Sat, 13 Sep 2014 12:35:59 GMT
Yes, it worked.  Sorry to have wasted everyone's time.  The property definition was in a target
that was called after using it in the classpath below-  The targets were named close to each
other, so wasn't seeing the difference for quite some time.  When I realised that and corrected
that, it worked for me as well.

Thanks.



-----Original Message-----
From: Urena, Jose M (JOSE) [mailto:jose.urena@verizon.com] 
Sent: Friday, September 12, 2014 6:55 PM
To: Ant Users List
Subject: RE: How to use a variable value in ANT refid

If you are using ant 1.8.2 or higher
These work for me

             <!-- possible options: weblogic | tomcat | noappserver -->
	<property name="appserver" value="weblogic" /> 


	<path id="tomcat.classpath">
		<fileset dir="${tc.lib}" includes="*.jar" />
	</path>

	<path id="weblogic.classpath">
		<fileset dir="${wl.modules}" includes="**/*.jar" />
		<fileset dir="${wl.lib}" includes="**/*.jar" />
	</path>
	<path id="noappserver.classpath">
		<fileset dir="${lib.dir}" includes="*.jar" />
	</path>

	<path id="compile.classpath">
		<path refid="lib.classpath" />
		<path refid="${appserver}.classpath" />
	</path>

-----Original Message-----
From: WebServices Development [mailto:WebServices_Development@csx.com] 
Sent: Friday, September 12, 2014 6:08 PM
To: Ant Users List
Subject: How to use a variable value in ANT refid

I am trying to use a value of a variable with path refid in ANT.

I tried different approaches and am getting different errors. Is it possible to use a variable
value for refid?

    <path id="compile.classpath">

        <path refid="shared.lib.classpath" />

        <path refid="ext.classpath" />

        <path refid="common.classpath" />

        <path refid="${ant.refid:seq.1}" />

        <path refid="ear.lib.classpath" />

    </path>

Reference ${ant.refid:seq.1} not found.



OR



    <path id="compile.classpath">

        <path refid="shared.lib.classpath" />

        <path refid="ext.classpath" />

        <path refid="common.classpath" />

        <path refid="${toString:seq.1}" />

        <path refid="ear.lib.classpath" />

    </path>

Unresolvable reference ${toString:seq.1} might be a misuse of property expansion syntax.



OR



    <path id="compile.classpath">

        <path refid="shared.lib.classpath" />

        <path refid="ext.classpath" />

        <path refid="common.classpath" />

        <path refid="${seq.1}" />

        <path refid="ear.lib.classpath" />

    </path>

Reference ${seq.1} not found.



This is how my seq.1 is defined



    <property name="seq.1" value="module.compile.classpath" />

    <echo>seq.1: ${seq.1}</echo>



which displays [echo] seq.1: module.compile.classpath

module.compile.classpath is defined elsewhere



and if I use

 <path id="compile.classpath">

        <path refid="shared.lib.classpath" />

        <path refid="ext.classpath" />

        <path refid="common.classpath" />

        <path refid="module.compile.classpath" />

        <path refid="ear.lib.classpath" />

    </path>

the build works.



So, How can I use a variable for refid to make it work? This way I can change the sequence
prior to defining the compile.classpath and use the appropriate sequence for the build I am
running?




This email transmission and any accompanying attachments may contain CSX privileged and confidential
information intended only for the use of the intended addressee. Any dissemination, distribution,
copying or action taken in reliance on the contents of this email by anyone other than the
intended recipient is strictly prohibited. If you have received this email in error please
immediately delete it and notify sender at the above CSX email address. Sender and CSX accept
no liability for any damage caused directly or indirectly by receipt of this email.


This email transmission and any accompanying attachments may contain CSX privileged and confidential
information intended only for the use of the intended addressee. Any dissemination, distribution,
copying or action taken in reliance on the contents of this email by anyone other than the
intended recipient is strictly prohibited. If you have received this email in error please
immediately delete it and notify sender at the above CSX email address. Sender and CSX accept
no liability for any damage caused directly or indirectly by receipt of this email.
Mime
View raw message