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}" /> +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.
+| Attribute | +Description | +Required | +
| value | +a single command line argument, can contain space + characters. | +Exactly one of these. | +
| line | +a space delimited list of command line arguments. | +|
| file | +The name of a file as a single command line + argument. Will be replaced with the absolute filename of the file + by Ant. | +|
| path | +A 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. | +
++ <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.
Some tasks use directory trees for the task they perform. For instance, the
Command line arguments should be specified as nested
+ It is possible to specify environment variables to pass to the
system command via nested Use nested
+ 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
+<arg> elements. See Command line arguments.env
<env> elements.<env> elements.
Examples
@@ -1793,7 +1860,9 @@ the one that is currently running Ant.
-<exec command="emacs" >
+<exec executable="emacs" >
<env key="DISPLAY" value=":1.0" />
</exec>
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
+<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
<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> +
<jvmarg> attributes, for example:
would run the test in a VM without JIT.
-| Attribute | -Description | -Required | -
| value | -a single command line argument. | -Exactly one of these. | -
| file | -The name of a file as a single command line argument. | -|
| path | -A 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. | -|
| line | -a space delimited list of command line arguments. | -
<jvmarg> allows all attributes described in Command line arguments.
<junit>.formatter..java or
<junit>.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);
}