You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Skip Hovsmith <sk...@maplerise.com> on 2000/10/12 00:35:45 UTC

Property values with '$' in them?

Hi all, I'm trying to set the value of a property to something that has a
'$' in it. For example:

  <property name="args" value="com.maplerise.MyClass$Test"/>

This doesn't get me what I wanted; it sets the value to
"com.maplerise.MyClassTest" instead.
So I naively tried:

  <property name="args" value="com.maplerise.MyClass$$Test"/>

which worked but seemed like a hack on my part.

Is there an officially proper way to set a '$' in a property value?

Regards, Skip Hovsmith

a possible bug in Exec ?

Posted by Andy XueWen Qin <aq...@cisco.com>.
I'm trying to use exec task on Windows NT, it's very simple
test build.xml file, but giving out a strange error. When I
change the dir="." to dir="..", it works fine, any ideas ?
The ant version I'm using is Ant1.1.
-----------
build.xml
------------
<?xml version="1.0" ?>
<project name="test" default="dist" basedir=".">
  <target name="dist" >
    <exec dir="." command="dir" os="Windows NT" output="dir.txt" />
  </target>
</project>
------------
error message:
-----------
build.xml:4: Error exec: dir
java.io.IOException: CreateProcess: dir error=2
        at java.lang.Win32Process.<init>(Compiled Code)
        at java.lang.Runtime.exec(Compiled Code)
        at java.lang.Runtime.exec(Runtime.java:137)
        at org.apache.tools.ant.taskdefs.Exec.run(Exec.java:124)
        at org.apache.tools.ant.taskdefs.Exec.execute(Exec.java:77)
        at org.apache.tools.ant.Target.execute(Compiled Code)
        at org.apache.tools.ant.Project.runTarget(Project.java:717)
        at org.apache.tools.ant.Project.executeTarget(Compiled Code)
        at org.apache.tools.ant.Project.executeTargets(Compiled Code)
        at org.apache.tools.ant.Main.runBuild(Compiled Code)
        at org.apache.tools.ant.Main.main(Main.java:107)

Total time: 0 seconds
------------------------

Thanks
/andy


RE: Property values with '$' in them?

Posted by Conor MacNeill <co...@ebinteractive.com.au>.
> -----Original Message-----
> From: Skip Hovsmith [mailto:skip@maplerise.com]
> Sent: Thursday, 12 October 2000 9:36
> To: ant-user@jakarta.apache.org
> Subject: Property values with '$' in them?
>
>
> Hi all, I'm trying to set the value of a property to something that has a
> '$' in it. For example:
>
>   <property name="args" value="com.maplerise.MyClass$Test"/>
>
> This doesn't get me what I wanted; it sets the value to
> "com.maplerise.MyClassTest" instead.
> So I naively tried:
>
>   <property name="args" value="com.maplerise.MyClass$$Test"/>
>
> which worked but seemed like a hack on my part.
>
> Is there an officially proper way to set a '$' in a property value?
>

Yes, and you found it. Its undocumented, but I guess that it must be
somewhat intuitive based on your experience.

Conor