In my ant build-file there is a property:
<property name="pwd" value="" description="value set external"/>
This property is set via GUI by the user. Later I want to call a java task and put the value of the property "pwd" as an argument to the java class:
<java classname="package.and.classname" dir="${directory}" fork="yes" failonerror="true">
<arg line="-u ${user}"/>
<arg line="-p ${pwd}"/>
<classpath>
<pathelement path="[...]"/>
</classpath>
</java>
This works fine until the user has a password containing a single quotation mark (') or a single double quotation mark (").
unbalanced quotes in -p pass'word
Okay - easy workaround for that:
<arg line="-p "${pwd}""/>
But the next case is that pwd = pass"word. The error then:
"The syntax of the command is incorrect."
And what will happen when both (' and ") are used?
I tried to escape the quotes with "
and/or '
but in the end nothing does really change in the behaviour.
Even if i exchange <arg line>
with <arg value>
for each parameter the problem still persists (but in fact now only for the double quotation mark or in the mixed case).
For example:
<arg value="-u"/>
<arg value="${user}"/>
<arg value="-p"/>
<arg value="${pwd}"/>
can work with pwd=pass'word
but not with pwd=pass"word
or pwd=pass"word
.
Is there any way to tell ant that the value of pwd
shouldn't be evaluated?