Search code examples
scriptingantescapingpropertiesquotes

How to display quote (") symbol in ant script


My ant script is,

<target name="temp">
    <property name="argument" value="xyz abc"/>
    <echo message=" & quot;${argument}& quot;"/>
</target>

Output is

xyz abc

Expected Output is

"xyz abc"

How to get the expected output. I tried like this &quot;quot;${argument}&quot;quot;, this is also not working.

Note : I am using ant 1.8.2 and antcontrib in windows 7.


Solution

  • Is there a space between & and quot;?

    This works for me:

    <target name="temp">
        <property name="argument" value="xyz abc"/>
        <echo message="&quot;${argument}&quot;"/>
    </target>
    

    Output:

    temp:
         [echo] "xyz abc"
    BUILD SUCCESSFUL
    Total time: 469 milliseconds