diff --git a/docs/index.html b/docs/index.html index 68e783bd7..98c6dd555 100644 --- a/docs/index.html +++ b/docs/index.html @@ -441,6 +441,56 @@ location attributes of its own, so

<classpath path="${classpath}" /> +

Command line arguments

+ +

Several tasks take arguments that shall be passed to another +process on the command line. To make it easier to specify arguments +that contain space characters, nested elements can be used.

+ + + + + + + + + + + + + + + + + + + + + + + +
AttributeDescriptionRequired
valuea single command line argument, can contain space + characters.Exactly one of these.
linea space delimited list of command line arguments.
fileThe name of a file as a single command line + argument. Will be replaced with the absolute filename of the file + by Ant.
pathA string that shall be treated as a PATH like + string as a single command line argument. You can use ; or : as + path separators and Ant will convert it to the platform's local + conventions.
+

Examples

+
+  <arg value="-l -a" />
+
+

is a single command line argument containing a space character.

+
+  <arg line="-l -a" />
+
+

stands for two separate command line arguments.

+
+  <arg path="/dir;/dir2:\dir3" />
+
+

is a single command line argument with value +\dir;\dir2;\dir3 on DOS based systems and +/dir:/dir2:/dir3 on Unix like systems.


Directory based tasks

Some tasks use directory trees for the task they perform. For instance, the command - the command to execute. - Yes + the command to execute with all command line + arguments. deprecated, use executable and nested + <arg> elements instead. + Exactly one of the two. + + + executable + the command to execute without any command line + arguments. dir @@ -1148,6 +1205,12 @@ systems.

redirected. No + + timeout + Stop the command if it doesn't finish within the + specified time (given in milliseconds). + No + failonerror Stop the buildprocess if the command exits with a @@ -1157,11 +1220,15 @@ systems.

Examples

-

<exec dir="${src}" command="dir" os="windows" +

<exec dir="${src}" executable="dir" os="windows" output="dir.txt" />

Parameters specified as nested elements

+

arg

+

Command line arguments should be specified as nested +<arg> elements. See Command line arguments.

env

It is possible to specify environment variables to pass to the system command via nested <env> elements.

@@ -1198,7 +1265,7 @@ system command via nested <env> elements.

Examples
-<exec command="emacs" >
+<exec executable="emacs" >
   <env key="DISPLAY" value=":1.0" />
 </exec>
 
@@ -1793,7 +1860,9 @@ the one that is currently running Ant.

args - the arguments for the class that is executed. + the arguments for the class that is + executed. deprecated, use nested <arg> + elements instead. No @@ -1817,15 +1886,15 @@ the one that is currently running Ant.

jvmargs - the arguments to pass to the forked VM (ignored if fork is - disabled) + the arguments to pass to the forked VM (ignored + if fork is disabled). deprecated, use nested + <arg> elements instead. No maxmemory Max amount of memory to allocate to the forked VM (ignored if fork is disabled) - all No @@ -1836,12 +1905,18 @@ the one that is currently running Ant.

Parameters specified as nested elements

+

arg and jvmarg

+

Use nested <arg> and <jvmarg> +elements to specify arguments for the or the forked VM. See Command line arguments.

+

classpath

Java's classpath attribute is a PATH like structure and can also be set via a nested classpath element.

-

Example

+
Example
  
-       <java classname="test.Main" args="-h" >
+       <java classname="test.Main" >
+         <arg value="-h" /> 
          <classpath>
            <pathelement location="\test.jar" />
            <pathelement path="${java.class.path}" />
@@ -1850,12 +1925,12 @@ href="#path">PATH like structure and can also be set via a nested
 

Examples

  <java classname="test.Main" />
-
  <java classname="test.Main" args="-h" />
  <java classname="test.Main"
-        args="-h"
-        fork="yes"
-        jvmargs="-Xrunhprof:cpu=samples,file=log.txt,depth=3"
-  />
+ fork="yes" > + <arg value="-h" /> + <jvmarg value="-Xrunhprof:cpu=samples,file=log.txt,depth=3" /> + </java> +

Javac

diff --git a/docs/junit.html b/docs/junit.html index ccf6f33c2..5a3332721 100644 --- a/docs/junit.html +++ b/docs/junit.html @@ -34,7 +34,7 @@ elements.

haltonerror - Stop the build process if an error occures during the test + Stop the build process if an error occurs during the test run. No, default is "off" @@ -85,32 +85,8 @@ VM via nested <jvmarg> attributes, for example:

would run the test in a VM without JIT.

- - - - - - - - - - - - - - - - - - - - - - - -
AttributeDescriptionRequired
valuea single command line argument.Exactly one of these.
fileThe name of a file as a single command line argument.
pathA string that shall be treated as a PATH - (i.e. the PATH separator will be set according to the plattform's - convention) as a single command line argument.
linea space delimited list of command line arguments.
+

<jvmarg> allows all attributes described in Command line arguments.

formatter

@@ -138,7 +114,7 @@ can be specified.

classname - Name of a custo formatter class. + Name of a custom formatter class. extension @@ -170,7 +146,7 @@ can be specified.

haltonerror - Stop the build process if an error occures during the test + Stop the build process if an error occurs during the test run. Overrides value set in <junit>. No @@ -183,7 +159,7 @@ can be specified.

outfile - Basename of the test result. The full filename is + Base name of the test result. The full filename is determined by this attribute and the extension of formatter. No, default is @@ -228,7 +204,7 @@ class name for each file that ends in .java or haltonerror - Stop the build process if an error occures during the test + Stop the build process if an error occurs during the test run. Overrides value set in <junit>. No @@ -301,7 +277,7 @@ stopped if the test fails.

Runs my.test.TestCase in the same VM (ignoring the given CLASSPATH), only a warning is printed if this test fails. In -addition to the plain text testresults, for this test a XML result +addition to the plain text test results, for this test a XML result will be output to result.xml.

For each matching file in the directory ${src.tests} a diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecTask.java b/src/main/org/apache/tools/ant/taskdefs/ExecTask.java index 87f3e7c9f..e8462c537 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecTask.java @@ -111,6 +111,9 @@ public class ExecTask extends Task { * The full commandline to execute, executable + arguments. */ public void setCommand(Commandline cmdl) { + log("The command attribute is deprecated. " + + "Please use the executable attribute and nested arg elements.", + Project.MSG_WARN); this.cmdl = cmdl; } diff --git a/src/main/org/apache/tools/ant/taskdefs/Java.java b/src/main/org/apache/tools/ant/taskdefs/Java.java index 77a729290..8e97f0e4b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Java.java +++ b/src/main/org/apache/tools/ant/taskdefs/Java.java @@ -166,6 +166,9 @@ public class Java extends Task { * Set the command line arguments for the class. */ public void setArgs(String s) { + log("The args attribute is deprecated. " + + "Please use nested arg elements.", + Project.MSG_WARN); cmdl.createArgument().setLine(s); } @@ -187,6 +190,9 @@ public class Java extends Task { * Set the command line arguments for the JVM. */ public void setJvmargs(String s) { + log("The args attribute is deprecated. " + + "Please use nested arg elements.", + Project.MSG_WARN); cmdl.createVmArgument().setLine(s); }