The task is used to combine a set of argument values into a single blank-separated argument string. This task is especially useful when writing code that must be run on different systems which require different methods of supplying argument data to the Ant exec task.

Attributes

The following table describes the task specific attributes for the task:

Task Specific Attributes
Attribute Description Required
property Name of the Ant property in which to return the argument string. Yes

Arg Elements

One or more Arg elements must be specified within the element. Arg elements are used to specify individual argument strings. At least one Arg element is required.

The following table describes the valid Arg element attributes and their options:

Arg Element Attributes
Attribute Description Required
value The value of the argument. Yes

Notes

Examples

Create an Scm.Cmd macro that must support Windows, Unix and z/OS. Note that a single Scm.Cmd macro call supports both forms of the exec task - individually specified arguments for Windows and a single blank-separated string for Unix and z/OS.

<!-- Scm.Cmd Macro -->
<macrodef name="Scm.Cmd">
    <attribute name="failonerror" default="true"/>
    <attribute name="failonresult" default="false"/>
    <attribute name="dir"/>
    <attribute name="output"/>
    <attribute name="result"/>
    <element name="args"/>
    <sequential>
        <BuildPropertyNonBlank property="scm.cmd"/>
        <BuildPropertyNonBlank property="scm.cfg"/>
        <BuildPropertyNonBlank property="scm.authenticate"/>
        <BuildPropertyNonBlank property="scm.repository"/>
        
        <local name="lcl.arguments"/>
        <xt:getArgString property="lcl.arguments">
            <args/>
        </xt:getArgString>
        
        <BuildPropertyNonBlank property="scm.password"/>
        <BuildPropertyNonBlank property="scm.userid"/>
        
        <local name="lcl.password"/>
        <xt:getPassword property="lcl.password" password="${scm.password}"/>
        
        <exec executable="${scm.cmd}" dir="@{dir}" failonerror="@{failonerror}" outputproperty="@{output}" resultproperty="@{result}" osfamily="windows">
            <arg value="--config"/>
            <arg value="${scm.cfg}"/>
            <arg value="--non-interactive"/>
            <args/>
            <arg value="-u"/>
            <arg value="${scm.userid}"/>
            <arg value="-P"/>
            <arg value="${lcl.password}"/>
        </exec>
        <exec executable="${scm.cmd}" dir="@{dir}" failonerror="@{failonerror}" outputproperty="@{output}" resultproperty="@{result}" osfamily="unix">
            <arg line="--config ${scm.cfg} --non-interactive ${lcl.arguments} -u ${scm.userid} -P ${lcl.password}"/>
        </exec>
        <exec executable="${scm.cmd}" dir="@{dir}" failonerror="@{failonerror}" outputproperty="@{output}" resultproperty="@{result}" osfamily="z/os">
            <arg line="--config ${scm.cfg} --non-interactive ${lcl.arguments} -u ${scm.userid} -P ${lcl.password}"/>
        </exec>
    </sequential>
</macrodef>
    

Call the Scm.Cmd macro to perform an SCM Accept without regard to the underlying system type:

<target name="main">
    
    <Scm.Cmd failonerror="true" output="outputProperty" result="resultProperty">
        <args>
            <arg value="accept"/>
            <arg value="-N"/>
            <arg value="-d"/>
            <arg value="${scm.dir}"/>
            <arg value="-s"/>
            <arg value="${source}"/>
            <arg value="-t"/>
            <arg value="${target}"/>
            <arg value="--baseline"/>
            <arg value="${baselines}"/>
        </args>
    </Scm.Cmd>
    
</target>