ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Stephenson <bstephen...@thortech-solutions.com>
Subject Re: <property name="test" value="foo$$$bar"/>
Date Thu, 26 Feb 2009 14:49:32 GMT
Stefan,
          The ant property task can take predefined properties, in the  
format "${property}", as part of a value (such as "${base.dir}/src"),  
so I suspect the behavior is related to the fact that the first time  
ant sees a dollar sign it thinks it will get a property, and then when  
it sees another $ it knows it isn't going to get one, so it drops the  
first one. It looks like ant drops every even $ (the second, the  
fourth, etc.) and leaves the odd ones alone.  Strange behavior. I  
tried regular expression escaping the character, but that did not work.

Still, THIS workaround actually gives you what you want, use it if you  
like:

<project name="test" default="make" basedir=".">
         <property name="dollar" value="$"/>
	<property name="test" value="foo${dollar}${dollar}${dollar}$ 
{dollar}bar"/>
	<target name="make">
		<echo>${test}</echo>
	</target>
</project>

Brian

On Feb 26, 2009, at 9:16 AM, Stefan Krause wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> If I define a property containig more than one "$", ant strips some
> of them.
>
> <project name="test" default="make" basedir=".">
> 	<property name="test" value="foo$$$$$bar"/>
> 	<target name="make">
> 		<echo>${test}</echo>
> 	</target>
> </project>
>
> foo$bar -> foo$bar
> foo$$bar -> foo$bar
> foo$$$bar -> foo$$bar
> foo$$$$$bar -> foo$$bar
>
> Is there any trick to keep the original string?
>
> Thanks,
>
> Stefan
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFJpqQkeiBYJLd+QfQRAvAnAJ4/wzDH3uhXgGBEIlpM2OACvhXe7QCbBqK1
> FkabyHzpPL1RPfqo7Ox7BKs=
> =Pp4o
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message