You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Vinodh Kumar <vi...@gmail.com> on 2011/12/15 19:23:48 UTC

Arg value not loaded

Hi,

Can someone let me know why the /${${env}.test} value not printed as
testest1/

*cmd*:ant -f build.xml -Denv=IT1

*build.xml*
<project name="Application Deployment" default="task" basedir=".">
	<property file="build.properties"/>
	<target name="task">
		<echo>${env}</echo>
		<echo>${${env}.test}</echo>
	</target>
</project>

*build.properties*
IT1.test=testest1


*OUTPUT:*
task:
     [echo] IT1
     [echo] ${${env}.test}

BUILD SUCCESSFUL
Total time: 0 seconds

--
View this message in context: http://ant.1045680.n5.nabble.com/Arg-value-not-loaded-tp5078350p5078350.html
Sent from the Ant - Users mailing list archive at Nabble.com.

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


Re: Arg value not loaded

Posted by "Scot P. Floess" <sf...@nc.rr.com>.
I can't remember the specific reasons why that won't expand...but I've had 
that issue in the past.  What I've done is to create a deref macrodef for 
that purpose.  Here is a fix (not sure its what you want):

<project name="Application Deployment" default="task" basedir=".">
     <macrodef name="deref">
         <attribute name="property"/>
         <attribute name="value"/>

         <sequential>
             <property name="@{property}" value="${@{value}}"/>
         </sequential>
     </macrodef>

     <property file="build.properties"/>
     <target name="task">
         <echo>${env}</echo>
         <deref property="myProperty" value="${env}.test"/>
         <echo>${myProperty}</echo>
     </target>
</project>

When I run using the same build.properties, I get this:


> ant -Denv=IT1

task:
      [echo] IT1
      [echo] testest1

BUILD SUCCESSFUL
Total time: 0 second


HTH,

Flossy


On Thu, 15 Dec 2011, Vinodh Kumar wrote:

> Hi,
>
> Can someone let me know why the /${${env}.test} value not printed as
> testest1/
>
> *cmd*:ant -f build.xml -Denv=IT1
>
> *build.xml*
> <project name="Application Deployment" default="task" basedir=".">
> 	<property file="build.properties"/>
> 	<target name="task">
> 		<echo>${env}</echo>
> 		<echo>${${env}.test}</echo>
> 	</target>
> </project>
>
> *build.properties*
> IT1.test=testest1
>
>
> *OUTPUT:*
> task:
>     [echo] IT1
>     [echo] ${${env}.test}
>
> BUILD SUCCESSFUL
> Total time: 0 seconds
>
> --
> View this message in context: http://ant.1045680.n5.nabble.com/Arg-value-not-loaded-tp5078350p5078350.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Scot P. Floess             RHCT  (Certificate Number 605010084735240)
Chief Architect FlossWare  http://sourceforge.net/projects/flossware
                            http://flossware.sourceforge.net
                            https://github.com/organizations/FlossWare

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