I've been wrestling with the apply task and trying to figure out why
this behavior is exhibited and how I can prevent it.

The task: [using ant 1.5.1]

    <target name="undeploy">
        <apply executable="${vhi.dir}\bin\deactivatemodel.bat"
               vmlauncher="false" dest="" relative="true">
            <arg value="-m"/>
            <targetfile/>
            <arg value="-s"/>
            <arg value="${vhiServer}"/>
            <fileset dir="${package.dir}" includes="*.zip"/>
            <mapper type="regexp" from="^(.*)\.zip$$" to="\1"/>
        </apply>
    </target>

There are a bunch of zip files in a directory, I'm stripping the ".zip"
extension and just using the extensionless name (target) as an argument
to a batch file.  I have no need to use the source file name in this
apply.  And yet, ant appends it as the last argument!  Example:

    [apply] Executing 'c:\Program Files\VHI\bin\deactivatemodel.bat'
with arguments:
    [apply] '-m'
    [apply] 'sonic5250_Connector_55'
    [apply] '-s'
    [apply] 'toddw-xp'
    [apply] 'sonic5250_Connector_55.zip'        <---   WHY DOES THIS
APPEAR AND HOW DO I STOP IT?
    [apply]
    [apply] The ' characters around the executable and arguments are
    [apply] not part of the command.
    [apply] Error: switch expected at: sonic5250_Connector_55.zip
    [apply] deactivatemodel -model, -m model_name
    [apply]               [ -server, -s vhi_server ]
    [apply]               [ -user, -u username  with  -password, -w
password ]
    [apply] deactivatemodel -help, -?
    [apply] Result: 1

The problem here is the "sonic5250_Connector_55.zip".  I don't believe
that my apply task specifies for this to appear, but it does and so the
batch file fails, not understanding the argument.


Reply via email to