Step Commands: <command> Element

Steps are executed by invoking the command line command specified by the <command> element. The <command> element's program attribute defines the location of the tool that will perform the command. It bears repeating that the tool must be located on the host and the agent invoking the tool must have access to it. In the following example, the location of the tool that will perform the command, the scripting tool groovy is being invoked, but any command can be run as long as it is in the path and available.

      <command program='${GROOVY_HOME}/bin/groovy'>

The actual command and any parameters it requires are passed to the tool by the <command> element's <arg> child element. Any number of <arg> elements can be used. The <arg> element has several attributes:

<arg> Element Attributes Table

Attribute Description
<value> Specifies a parameter passed to the tool. Format is tool-specific; must be enclosed by single-quotes.
<path> Path to files or classes required by the tool. Must be enclosed by single-quotes.
<file> Specifies the path to any files required by the tool. Format is tool-specific; must be enclosed by single-quotes.

Because <arg> elements are processed in the order they are defined, ensured the order conforms to that expected by the tool.


<command program='${GROOVY_HOME}/bin/groovy'>
  <arg value='-cp' />
  <arg path='classes:${sdkJar}:lib/commons-codec.jar:
                  lib/activation-1.1.1.jar:
                  lib/commons-logging.jar:lib/httpclient-cache.jar:
                  lib/httpclient.jar:lib/httpcore.jar:
                  lib/httpmime.jar:lib/javamail-1.4.1.jar' />
  <arg file='registerInstancesWithLB.groovy' />
  <arg file='${PLUGIN_INPUT_PROPS}' />
  <arg file='${PLUGIN_OUTPUT_PROPS}' />
</command>

The <arg file='${PLUGIN_INPUT_PROPS}' />

specifies the location of the tool-supplied properties file.

The <arg file='${PLUGIN_OUTPUT_PROPS}' />

specifies the location of the file that will contain the step-generated properties.

Note: New lines are not supported by the <arg> element and are shown in this example only for presentation.