diff --git a/manual/Tasks/ant.html b/manual/Tasks/ant.html index f417efd9a..65b9d7772 100644 --- a/manual/Tasks/ant.html +++ b/manual/Tasks/ant.html @@ -293,6 +293,7 @@ will be set to the specified value of the property element unless the correspond the dir attribute explicitly.

Examples

+

These are different ways of using the task:

 <ant antfile="subproject/subbuild.xml" target="compile"/>
 
@@ -325,12 +326,12 @@ this:

</path>

and the called build file (subbuild.xml) also defines a <path> -with the id path1, but path2 is not defined:

+with the id path1, but path2 is not defined; then

<ant antfile="subbuild.xml" inheritrefs="true"/>

will not override subbuild's definition of path1, but make the parent's -definition of path2 available in the subbuild.

+definition of path2 available in the subbuild, whereas

<ant antfile="subbuild.xml"/>
@@ -338,14 +339,14 @@ definition of path2 available in the subbuild.

<ant antfile="subbuild.xml" inheritrefs="false"/>
-

will neither override path1 nor copy path2.

+

will neither override path1 nor copy path2, while

 <ant antfile="subbuild.xml" inheritrefs="false">
   <reference refid="path1"/>
 </ant>
-

will override subbuild's definition of path1.

+

will override subbuild's definition of path1, and

 <ant antfile="subbuild.xml" inheritrefs="false">
diff --git a/manual/Tasks/antcall.html b/manual/Tasks/antcall.html
index 201cbf340..1beed1321 100644
--- a/manual/Tasks/antcall.html
+++ b/manual/Tasks/antcall.html
@@ -154,6 +154,7 @@ single target whose dependencies are the targets so specified, in the order spec
 
 
 

Examples

+

The following

 <target name="default">
   <antcall target="doSomethingElse">
@@ -164,13 +165,11 @@ single target whose dependencies are the targets so specified, in the order spec
 <target name="doSomethingElse">
   <echo message="param1=${param1}"/>
 </target>
-

Will run the target doSomethingElse and echo param1=value.

- +

will run the target doSomethingElse and echo param1=value, whereas

 <antcall ... >
   <reference refid="path1" torefid="path2"/>
 </antcall>
-

will copy the parent's definition of path1 into the new project using the id path2.

diff --git a/manual/Tasks/antlr.html b/manual/Tasks/antlr.html index 996809b03..741f9f7ed 100644 --- a/manual/Tasks/antlr.html +++ b/manual/Tasks/antlr.html @@ -137,12 +137,12 @@ nested <jvmarg> attributes, for example:

in Command line arguments.

Example

+

Invoke ANTLR on grammar file etc/java.g, writing the generated files +to build/src:

 <antlr
     target="etc/java.g"
     outputdirectory="build/src"/>
-

This invokes ANTLR on grammar file etc/java.g, writing the generated files -to build/src.

diff --git a/manual/Tasks/antstructure.html b/manual/Tasks/antstructure.html index 4b2988b22..37ddfcd7c 100644 --- a/manual/Tasks/antstructure.html +++ b/manual/Tasks/antstructure.html @@ -64,11 +64,11 @@ task—see the example below.

Examples

-
<antstructure output="project.dtd"/>
+

Basic usage

-

Emitting your own structure instead of a DTD

+
<antstructure output="project.dtd"/>
-

First you need to implement the interface

+

Emit your own structure instead of a DTD: first you need to implement the interface

 package org.example;
@@ -85,8 +85,8 @@ public class MyPrinter implements AntStructure.StructurePrinter {
   <myprinter/>
 </antstructure>
-

Your own StructurePrinter can accept attributes and nested elements just like any other Ant type -or task.

+

Your own StructurePrinter can accept attributes and nested elements +just like any other Ant type or task.

diff --git a/manual/Tasks/antversion.html b/manual/Tasks/antversion.html index e1a0f0039..6022d7675 100644 --- a/manual/Tasks/antversion.html +++ b/manual/Tasks/antversion.html @@ -62,17 +62,19 @@ as condition).

Examples

+

Store the current Ant version in the property antversion.

<antversion property="antversion"/>
-

Stores the current Ant version in the property antversion.

+

Store the Ant version in the property antversion if the current Ant version is 1.6.0 +or higher. Otherwise the property remains unset.

<antversion property="antversion" atleast="1.6"/>
-

Stores the Ant version in the property antversion if the current Ant version is -1.6.0 or higher. Otherwise the property remains unset.

-
<antversion property="ant-is-exact-7" exactly="1.7.0"/>
-

Sets the property ant-is-exact-7 if Ant 1.7.0 is running. Neither 1.6.5 nor 1.7.1 +

Set the property ant-is-exact-7 if Ant 1.7.0 is running. Neither 1.6.5 nor 1.7.1 would match.

+
<antversion property="ant-is-exact-7" exactly="1.7.0"/>
+

Set Ant17isOnline if Ant 1.7.0 is running and can get a non-error-response from the +Ant homepage.

 <condition property="Ant17isOnline">
   <and>
@@ -80,8 +82,6 @@ would match.

<http url="http://ant.apache.org"/> </and> </condition>
-

Sets Ant17isOnline if Ant 1.7.0 is running and can get a non-error-response from the -Ant homepage.

diff --git a/manual/Tasks/apply.html b/manual/Tasks/apply.html index bb63d6139..d85c0e232 100644 --- a/manual/Tasks/apply.html +++ b/manual/Tasks/apply.html @@ -350,6 +350,9 @@ files for each sourcefile.

(with maxparallel > 0) and null will be used a source file just like it is in the case of exec.

Examples

+

Invoke ls -l, adding the absolute filenames of all files below /tmp not +ending in .txt and all files of the FileSet with id other.files +to the command line.

 <apply executable="ls">
   <arg value="-l"/>
@@ -360,9 +363,11 @@ of exec.

</fileset> <fileset refid="other.files"/> </apply>
-

invokes ls -l, adding the absolute filenames of all files below /tmp not -ending in .txt and all files of the FileSet with id other.files -to the command line.

+ +

Invoke somecommand arg1 SOURCEFILENAME arg2 for each file in /tmp +replacing SOURCEFILENAME with the absolute filename of each file in +turn. If parallel had been set to true, SOURCEFILENAME would be +replaced with the absolute filenames of all files separated by spaces.

 <apply executable="somecommand" parallel="false">
   <arg value="arg1"/>
@@ -371,10 +376,11 @@ to the command line.

<fileset dir="/tmp"/> </apply>
-

invokes somecommand arg1 SOURCEFILENAME arg2 for each file in /tmp -replacing SOURCEFILENAME with the absolute filename of each file in -turn. If parallel had been set to true, SOURCEFILENAME would be replaced -with the absolute filenames of all files separated by spaces.

+ +

Invoke cc -c -o TARGETFILE SOURCEFILE for each .c file that is newer than +the corresponding .o, replacing TARGETFILE with the absolute filename of +the .o and SOURCEFILE with the absolute name of the .c +file.

 <apply executable="cc" dest="src/C" parallel="false">
   <arg value="-c"/>
@@ -384,10 +390,15 @@ with the absolute filenames of all files separated by spaces.

<fileset dir="src/C" includes="*.c"/> <mapper type="glob" from="*.c" to="*.o"/> </apply>
-

invokes cc -c -o TARGETFILE SOURCEFILE for each .c file that is newer -than the corresponding .o, replacing TARGETFILE with the absolute filename -of the .o and SOURCEFILE with the absolute name of the .c -file.

+ +

Apply the fictitious processfile executable to all files matching *.file +in the src directory. The out <mapper> has been set up +to map *.file to *.out, then this <mapper> is used to +specify targetfiles for this <apply> task. A reference +to out is then used as an <outputmapper> nested in +a <redirector>, which in turn is nested beneath this <apply> +instance. This allows us to perform dependency checking against output files—the target files +in this case.

 <mapper id="out" type="glob"
            from="src${file.separator}*.file"
@@ -400,15 +411,9 @@ file.

<outputmapper refid="out"/> </redirector> </apply>
-

Applies the fictitious processfile executable to all files -matching *.file in the src directory. -The out <mapper> has been set up to map *.file -to *.out, then this <mapper> is used to -specify targetfiles for this <apply> task. A reference -to out is then used as an <outputmapper> nested in -a <redirector>, which in turn is nested beneath this <apply> -instance. This allows us to perform dependency checking against output files—the target files -in this case.

+ +

Apply the ls executable to all directories in the PATH, effectively +listing all executables that are available on the PATH.

 <apply executable="ls" parallel="true"
        force="true" dest="${basedir}" append="true" type="both">
@@ -417,9 +422,10 @@ in this case.

</path> <identitymapper/> </apply>
-

Applies the ls executable to all directories in the PATH, effectively -listing all executables that are available on the PATH.

+

Convert all JavaScript files in the src directory using the command jsmin < +src/a.js > dest/a.js. Because the filename itself should not be passed to +the jsmin program, the addsourcefile is set to false.

 <apply executable="jsmin" addsourcefile="false">
     <!-- Collect the JS-files -->
@@ -432,9 +438,6 @@ listing all executables that are available on the PATH.

<outputmapper id="out" type="glob" from="*.js" to="dest/*.js"/> </redirector> </apply>
-

Conversion of the command jsmin < src/a.js > dest/a.js but for all files in -the src directory. Because the filename itself should not be passed to -the jsmin program, the addsourcefile is set to false.

diff --git a/manual/Tasks/attrib.html b/manual/Tasks/attrib.html index 07e59897a..552f270cf 100644 --- a/manual/Tasks/attrib.html +++ b/manual/Tasks/attrib.html @@ -129,16 +129,17 @@ alternative.

Examples

+

Make the run.bat file read-only and hidden.

<attrib file="${dist}/run.bat" readonly="true" hidden="true"/>
-

makes the run.bat file read-only and hidden.

- +

Make all .xml files below ${meta.inf} readable.

<attrib readonly="false">
   <fileset dir="${meta.inf}" includes="**/*.xml"/>
 </attrib>
-

makes all .xml files below ${meta.inf} readable.

- +

Make all files below shared/sources1 (except those below any directory +named trial) read-only and archived. In addition all files belonging to a FileSet +with id other.shared.sources get the same attributes.

 <attrib readonly="true" archive="true">
   <fileset dir="shared/sources1">
@@ -147,9 +148,5 @@ alternative.

<fileset refid="other.shared.sources"/> </attrib>
-

makes all files below shared/sources1 (except those below any directory -named trial) read-only and archived. In addition all files belonging to a FileSet -with id other.shared.sources get the same attributes.

- diff --git a/manual/Tasks/augment.html b/manual/Tasks/augment.html index 3dc64f9f2..f39368bf6 100644 --- a/manual/Tasks/augment.html +++ b/manual/Tasks/augment.html @@ -58,16 +58,18 @@ declared augment element as though it were the original element.

<fileset id="input-fs" dir="${basedir}"/>
+

invocation

+
<augment id="input-fs" excludes="foo"/>
-

modifies the excludes attribute of input-fs.

+

modifies the excludes attribute of input-fs, whereas

 <augment id="input-fs">
   <filename name="bar"/>
 </augment>
-

Adds a filename selector to input-fs.

+

adds a filename selector to input-fs.

diff --git a/manual/Tasks/available.html b/manual/Tasks/available.html index 9b8073413..48ceda93d 100644 --- a/manual/Tasks/available.html +++ b/manual/Tasks/available.html @@ -110,20 +110,27 @@ a path-like structure and can also be set via a

Available's filepath attribute is a path-like structure and can also be set via a nested <filepath> element.

+

Examples

-
<available classname="org.whatever.Myclass" property="Myclass.present"/>
-

sets the Myclass.present property to the value true if the +

Set the Myclass.present property to the value true if the class org.whatever.Myclass is found in Ant's classpath.

+
<available classname="org.whatever.Myclass" property="Myclass.present"/>
+ +

Set the jaxp.jar.present property to the value true if the +file ./lib/jaxp11/jaxp.jar is found.

 <property name="jaxp.jar" value="./lib/jaxp11/jaxp.jar"/>
 <available file="${jaxp.jar}" property="jaxp.jar.present"/>
-

sets the jaxp.jar.present property to the value true if the -file ./lib/jaxp11/jaxp.jar is found.

+ +

Set the local.lib.present property to the value true if the +directory /usr/local/lib is found.

 <available file="/usr/local/lib" type="dir"
            property="local.lib.present"/>
-

sets the local.lib.present property to the value true if the -directory /usr/local/lib is found.

+ +

Set the jaxp11.present property to the value true if the +class javax.xml.transform.Transformer is found in the classpath referenced +by jaxp (in this case, ./lib/jaxp11/jaxp.jar).

 ...in project ...
 <property name="jaxp.jar" value="./lib/jaxp11/jaxp.jar"/>
@@ -131,19 +138,15 @@ directory /usr/local/lib is found.

...in target ... <available classname="javax.xml.transform.Transformer" classpathref="jaxp" property="jaxp11.present"/>
-

sets the jaxp11.present property to the value true if the -class javax.xml.transform.Transformer is found in the classpath referenced -by jaxp (in this case, ./lib/jaxp11/jaxp.jar). -

+ +

Set the have.extras property to the value true if the resource +file extratasks.properties is found.

 <available property="have.extras" resource="extratasks.properties">
   <classpath>
     <pathelement location="/usr/local/ant/extra.jar"/>
   </classpath>
 </available>
-

sets the have.extras property to the value true if the resource -file extratasks.properties is found. -

diff --git a/manual/Tasks/basename.html b/manual/Tasks/basename.html index c52e2bdcc..dcf622b6d 100644 --- a/manual/Tasks/basename.html +++ b/manual/Tasks/basename.html @@ -59,20 +59,22 @@ the simple file name, without any directory elements.

Examples

-
<basename property="jar.filename" file="${lib.jarfile}"/>
-

will set jar.filename to myjar.jar, if lib.jarfile is -defined as either a full-path filename (eg., /usr/local/lib/myjar.jar), a relative-path +

Set jar.filename to myjar.jar, if lib.jarfile is defined +as either a full-path filename (eg., /usr/local/lib/myjar.jar), a relative-path filename (eg., lib/myjar.jar), or a simple filename (eg., myjar.jar).

+
<basename property="jar.filename" file="${lib.jarfile}"/>
+ +

Set cmdname to foo.

 <basename property="cmdname" file="D:/usr/local/foo.exe"
           suffix=".exe"/>
-

will set cmdname to foo.

+ +

Set temp.dirname to the last directory element of the path defined for +the TEMP environment variable.

 <property environment="env"/>
 <basename property="temp.dirname" file="${env.TEMP}"/>
 
-

will set temp.dirname to the last directory element of the path defined for -the TEMP environment variable.

diff --git a/manual/Tasks/buildnumber.html b/manual/Tasks/buildnumber.html index f2eab0849..db8e69b72 100644 --- a/manual/Tasks/buildnumber.html +++ b/manual/Tasks/buildnumber.html @@ -48,13 +48,11 @@ need finer control over things such as the property name or the number format.)<

Examples

-
<buildnumber/>
-

Read, increment, and write a build number to the default file, build.number.

- -
<buildnumber file="mybuild.number"/>
+
<buildnumber/>

Read, increment, and write a build number to the file mybuild.number.

+
<buildnumber file="mybuild.number"/>
diff --git a/manual/Tasks/cab.html b/manual/Tasks/cab.html index 84c3b20c0..9d33565a8 100644 --- a/manual/Tasks/cab.html +++ b/manual/Tasks/cab.html @@ -106,29 +106,32 @@ element to specify the files to be included in the archive. If this is specifie the basedir attribute cannot be used.

Examples

+

Cab all files in the htdocs/manual directory into a file +called manual.cab in the ${dist} directory.

 <cab cabfile="${dist}/manual.cab"
      basedir="htdocs/manual"/>
-

cabs all files in the htdocs/manual directory into a file -called manual.cab in the ${dist} directory.

+ +

Cab all files in the htdocs/manual directory into a file +called manual.cab in the ${dist} directory. Files in the +directory mydocs, or files with the name todo.html are excluded.

 <cab cabfile="${dist}/manual.cab"
      basedir="htdocs/manual"
      excludes="mydocs/**, **/todo.html"/>
-

cabs all files in the htdocs/manual directory into a file -called manual.cab in the ${dist} directory. Files in the -directory mydocs, or files with the name todo.html are excluded.

+ +

Cab all files in the htdocs/manual directory into a file +called manual.cab in the ${dist} directory. Only .html files +under the directory api are archived, and files with the name todo.html +are excluded. Output from the cabarc tool is displayed in the build output.

 <cab cabfile="${dist}/manual.cab"
      basedir="htdocs/manual"
      includes="api/**/*.html"
      excludes="**/todo.html"
      verbose="yes"/>
-

Cab all files in the htdocs/manual directory into a file -called manual.cab in the ${dist} directory. Only .html files -under the directory api are archived, and files with the name todo.html -are excluded. Output from the cabarc tool is displayed in the build output.

+

The following is equivalent to the example above.

 <cab cabfile="${dist}/manual.cab"
      verbose="yes">
@@ -137,7 +140,6 @@ are excluded. Output from the cabarc tool is displayed in the build
        includes="api/**/*.html"
        excludes="**/todo.html"/>
 </cab>
-

is equivalent to the example above.

diff --git a/manual/Tasks/ccm.html b/manual/Tasks/ccm.html index ed2ded848..20b572549 100644 --- a/manual/Tasks/ccm.html +++ b/manual/Tasks/ccm.html @@ -74,13 +74,12 @@ other platforms with ccm installed.

Examples

+

Check in the file c:/wa/com/foo/MyFile.java. Text mycomment is added +as a comment. The task used is the one set as the default.

 <ccmcheckin file="c:/wa/com/foo/MyFile.java"
             comment="mycomment"/>
-

Checks in the file c:/wa/com/foo/MyFile.java. Text mycomment is added -as a comment. The task used is the one set as the default.

-

CCMCheckout

@@ -121,14 +120,16 @@ as a comment. The task used is the one set as the default.

Examples

+

Check out the file c:/wa/com/foo/MyFile.java. Comment +attribute mycomment is added as a task comment. The task used is the one set as the +default.

 <ccmcheckout file="c:/wa/com/foo/MyFile.java"
              comment="mycomment"/>
-

Check out the file c:/wa/com/foo/MyFile.java. Comment -attribute mycomment is added as a task comment The used task is the one set as the -default.

- +

Check out all the files in the lib directory having the .jar +extension. Comment attribute mycomment is added as a task comment The used task is the +one set as the default.

 <ccmcheckout comment="mycomment">
   <fileset dir="lib" >
@@ -136,10 +137,6 @@ default.

</fileset> </ccmcheckout >
-

Check out all the files in the lib directory having the .jar extension. -Comment attribute mycomment is added as a task comment The used task is the one set as -the default.

-

CCMCheckinTask

@@ -171,10 +168,9 @@ the default.

Examples

+

Perform a Checkin default task on all the checked out files in the current task.

<ccmcheckintask comment="blahblah/>
-

Does a Checkin default task on all the checked out files in the current task.

-

CCMReconfigure

@@ -211,12 +207,11 @@ the default.

Examples

+

Perform a Continuus reconfigure on the project ANTCCM_TEST#BMO_1.

 <ccmreconfigure ccmproject="ANTCCM_TEST#BMO_1"
                 verbose="true"/>
-

Does a Continuus reconfigure on the project ANTCCM_TEST#BMO_1.

-

CCMCreateTask

@@ -268,12 +263,11 @@ the default.

Examples

+

Create a task for the release ANTCCM_TEST with the current user as the resolver for +this task.

 <ccmcreatetask resolver="${user.name}"
                release="ANTCCM_TEST" comment="blahblah"/>
-

Creates a task for the release ANTCCM_TEST with the current user as the resolver for -this task.

- diff --git a/manual/Tasks/changelog.html b/manual/Tasks/changelog.html index 4b018efd5..b0304691a 100644 --- a/manual/Tasks/changelog.html +++ b/manual/Tasks/changelog.html @@ -184,59 +184,53 @@ attribute can contain spaces in their name.

Examples

+

Generate a change log report for all the changes that have been made under +the dve/network directory. Write these changes into the +file changelog.xml.

 <cvschangelog dir="dve/network"
               destfile="changelog.xml"/>
-

Generates a change log report for all the changes that have been made under -the dve/network directory. It writes these changes into the -file changelog.xml.

- +

Generate a change log report for any changes that were made under the dve/network +directory in the past 10 days. Write these changes into the file changelog.xml.

 <cvschangelog dir="dve/network"
               destfile="changelog.xml"
               daysinpast="10"/>
-

Generates a change log report for any changes that were made under the dve/network -directory in the past 10 days. It writes these changes into the +

Generate a change log report for any changes that were made between February 20, 2002 and March +20, 2002 under the dve/network directory. Write these changes into the file changelog.xml.

-
 <cvschangelog dir="dve/network"
               destfile="changelog.xml"
               start="20 Feb 2002"
               end="20 Mar 2002"/>
-

Generates a change log report for any changes that were made between February 20, 2002 and March -20, 2002 under the dve/network directory. It writes these changes into the +

Generate a change log report for any changes that were made after February 20, 2002 under +the dve/network directory. Write these changes into the file changelog.xml.

-
 <cvschangelog dir="dve/network"
               destfile="changelog.xml"
               start="20 Feb 2002"/>
-

Generates a change log report for any changes that were made after February 20, 2002 under -the dve/network directory. It writes these changes into the -file changelog.xml.

- +

Generate a change log report for all the changes that were made under +the dve/network directory, substituting the name Peter Donald in +the <author> tags anytime a change made by the user ID donaldp is +encountered. Write these changes into the file changelog.xml.

 <cvschangelog dir="dve/network"
               destfile="changelog.xml">
     <user displayname="Peter Donald" userid="donaldp"/>
 </cvschangelog>
-

Generates a change log report for all the changes that were made under -the dve/network directory, substituting the name Peter Donald in -the <author> tags anytime it encounters a change made by the user -ID donaldp. It writes these changes into the file changelog.xml.

- -

Generates a change log report on the ANT_16_BRANCH.

+

Generate a change log report on the ANT_16_BRANCH.

 <cvschangelog dir="c:/dev/asf/ant.head" passfile="c:/home/myself/.cvspass"
               destfile="changelogant.xml" tag="ANT_16_BRANCH"/>

Generate Report

-

Ant includes a basic XSLT stylesheet that you can use to generate a HTML report based on the xml +

Ant includes a basic XSLT stylesheet that you can use to generate a HTML report based on the XML output. The following example illustrates how to generate a HTML report from the XML report.

diff --git a/manual/Tasks/checksum.html b/manual/Tasks/checksum.html
index dadeb3912..c5f5bd16c 100644
--- a/manual/Tasks/checksum.html
+++ b/manual/Tasks/checksum.html
@@ -173,50 +173,54 @@ target="_top">Cryptography Architecture Standard Algorithm Name Documentation
 
 

Examples

+

Example 1

-
<checksum file="foo.bar"/>
-

Generates a MD5 checksum for foo.bar and stores the checksum in the destination +

Generate a MD5 checksum for foo.bar and store the checksum in the destination file foo.bar.MD5. foo.bar.MD5 is overwritten only if foo.bar is newer than itself.

+
<checksum file="foo.bar"/>

Example 2

-
<checksum file="foo.bar" forceOverwrite="yes"/>
-

Generates a MD5 checksum for foo.bar and stores the checksum +

Generate a MD5 checksum for foo.bar and store the checksum in foo.bar.MD5. If foo.bar.MD5 already exists, it is overwritten.

+
<checksum file="foo.bar" forceOverwrite="yes"/>

Example 3

-
<checksum file="foo.bar" property="foobarMD5"/>
-

Generates a MD5 checksum for foo.bar and stores it in the project +

Generate a MD5 checksum for foo.bar and store it in the project property foobarMD5.

+
<checksum file="foo.bar" property="foobarMD5"/>

Example 4

+

Generate a MD5 checksum for foo.bar, compare it against foo.bar.MD5 and +set isMD5ok to either true or false, depending upon the result.

<checksum file="foo.bar" verifyProperty="isMD5ok"/>
-

Generates a MD5 checksum for foo.bar, compares it against foo.bar.MD5 -and sets isMD5ok to either true or false, depending upon the result.

Example 5

-
<checksum file="foo.bar" algorithm="SHA-512" fileext="asc"/>
-

Generates a SHA-512 checksum for foo.bar and stores the checksum in the destination +

Generate a SHA-512 checksum for foo.bar and store the checksum in the destination file foo.bar.asc. foo.bar.asc is overwritten only if foo.bar is newer than itself.

+
<checksum file="foo.bar" algorithm="SHA-512" fileext="asc"/>

Example 6

-
<checksum file="foo.bar" property="${md5}" verifyProperty="isEqual"/>
-

Generates a MD5 checksum for foo.bar, compares it against the value of the -property md5, and sets isEqual to either true or false, +

Generate a MD5 checksum for foo.bar, compare it against the value of the +property md5, and set isEqual to either true or false, depending upon the result.

+
<checksum file="foo.bar" property="${md5}" verifyProperty="isEqual"/>

Example 7

+

Just like Example 1, but generates a .MD5 file for every file that begins with the +name foo.

 <checksum>
   <fileset dir=".">
     <include name="foo*"/>
   </fileset>
 </checksum>
-

Works just like Example 1, but generates a .MD5 file for every file that begins with -the name foo.

Example 8

+

Just like Example 4, but only sets isChecksumEqual to true, if the checksum +matches—it will never be set to false. This example demonstrates use with +the condition task.

 <condition property="isChecksumEqual">
   <checksum>
@@ -225,9 +229,6 @@ the name foo.

</fileset> </checksum> </condition>
-

Works like Example 4, but only sets isChecksumEqual to true, if the checksum -matches—it will never be set to false. This example demonstrates use with -the condition task.

Note

When working with more than one file, if condition and/or verifyproperty is used, the diff --git a/manual/Tasks/chgrp.html b/manual/Tasks/chgrp.html index 29e8bf496..88ec1c78c 100644 --- a/manual/Tasks/chgrp.html +++ b/manual/Tasks/chgrp.html @@ -110,19 +110,21 @@ set its value to your current OS.

Examples

-
<chgrp file="${dist}/start.sh" group="coders"/>
-

makes the start.sh file belong to the coders group on a UNIX -system.

+

Make the start.sh file belong to the coders group on a UNIX system.

+
<chgrp file="${dist}/start.sh" group="coders"/>
+

Make all .sh files below ${dist}/bin belong to the coders +group on a UNIX system.

 <chgrp group="coders">
   <fileset dir="${dist}/bin" includes="**/*.sh"/>
 </chgrp>
-

makes all .sh files below ${dist}/bin belong to the coders -group on a UNIX system.

- +

Make all files below shared/sources1 (except those below any directory +named trial) belong to the coders group on a UNIX system. In addition, all +files belonging to a FileSet with id=other.shared.sources get the same +group.

 <chgrp group="coders">
   <fileset dir="shared/sources1">
@@ -132,11 +134,10 @@ group on a UNIX system.

</chgrp>
-

makes all files below shared/sources1 (except those below any directory -named trial) belong to the coders group on a UNIX system. In addition all -files belonging to a FileSet with id other.shared.sources get the same -group.

- +

Make all .test.jsp, and .new files belong to +group webdev. Directories with names beginning with test_ also will belong +to webdev, but if there is a directory name that ends in .new or a file +name that begins with test_ it will be unaffected.

 <chgrp group="webdev" type="file">
   <fileset dir="/web">
@@ -148,10 +149,5 @@ group.

</dirset> </chmod>
-

makes all .test.jsp, and .new files belong to -group webdev. Directories with names beginning with test_ also will belong -to webdev, but if there is a directory name that ends in .new or a file -name that begins with test_ it will be unaffected.

- diff --git a/manual/Tasks/chmod.html b/manual/Tasks/chmod.html index 8f79379c2..b20f814f3 100644 --- a/manual/Tasks/chmod.html +++ b/manual/Tasks/chmod.html @@ -138,19 +138,24 @@ alternative.

Examples

+ +

Make the start.sh file readable and executable for anyone on a UNIX system.

<chmod file="${dist}/start.sh" perm="ugo+rx"/>
-

makes the start.sh file readable and executable for anyone on a UNIX system.

-
<chmod file="${dist}/start.sh" perm="700"/>
-

makes the start.sh file readable, writable and executable only for the owner on a +

Make the start.sh file readable, writable and executable only for the owner on a UNIX system.

+
<chmod file="${dist}/start.sh" perm="700"/>
+

Make all .sh files below ${dist}/bin readable and executable for anyone +on a UNIX system.

 <chmod dir="${dist}/bin" perm="ugo+rx"
        includes="**/*.sh"/>
-

makes all .sh files below ${dist}/bin readable and executable for -anyone on a UNIX system.

+

Make all files below shared/sources1 (except those below any directory +named trial) writable for members of the same group on a UNIX system. In addition, all +files belonging to a FileSet with id other.shared.sources get the same +permissions.

 <chmod perm="g+w">
   <fileset dir="shared/sources1">
@@ -158,10 +163,10 @@ anyone on a UNIX system.

</fileset> <fileset refid="other.shared.sources"/> </chmod>
-

makes all files below shared/sources1 (except those below any directory named trial) -writable for members of the same group on a UNIX system. In addition all files belonging to a -FileSet with id other.shared.sources get the same permissions.

+

Keep non-owners from touching cgi scripts, files with a .old extension +or directories beginning with private_. A directory ending in .old or a +file beginning with private_ would remain unaffected.

 <chmod perm="go-rwx" type="file">
   <fileset dir="/web">
@@ -172,9 +177,6 @@ FileSet with id other.shared.sources get the same permis
     <include name="**/private_*"/>
   </dirset>
 </chmod>
-

keeps non-owners from touching cgi scripts, files with a .old extension or -directories beginning with private_. A directory ending in .old or a file -beginning with private_ would remain unaffected.

Note on maxparallel attribute

Some shells have a limit of the number of characters that a command line may contain. This diff --git a/manual/Tasks/chown.html b/manual/Tasks/chown.html index 55a17acb8..4a700c7dd 100644 --- a/manual/Tasks/chown.html +++ b/manual/Tasks/chown.html @@ -111,16 +111,20 @@ value to your current OS.

Examples

+ +

Make the start.sh file belong to coderjoe on a UNIX system.

<chown file="${dist}/start.sh" owner="coderjoe"/>
-

makes the start.sh file belong to coderjoe on a UNIX system.

+

Make all .sh files below ${dist}/bin belong to coderjoe on +a UNIX system.

 <chown owner="coderjoe">
   <fileset dir="${dist}/bin" includes="**/*.sh"/>
 </chown>
-

makes all .sh files below ${dist}/bin belong to coderjoe -on a UNIX system.

+

Make all files below shared/sources1 (except those below any directory +named trial) belong to coderjoe on a UNIX system. In addition, all files +belonging to a FileSet with id=other.shared.sources get the same owner.

 <chown owner="coderjoe">
   <fileset dir="shared/sources1">
@@ -128,10 +132,10 @@ on a UNIX system.

</fileset> <fileset refid="other.shared.sources"/> </chown>
-

makes all files below shared/sources1 (except those below any directory -named trial) belong to coderjoe on a UNIX system. In addition all files -belonging to a FileSet with id other.shared.sources get the same owner.

+

Make cgi scripts, files with a .old extension or directories beginning +with private_ belong to the user named webadmin. A directory ending +in .old or a file beginning with private_ would remain unaffected.

 <chown owner="webadmin" type="file">
   <fileset dir="/web">
@@ -142,9 +146,6 @@ belonging to a FileSet with id other.shared.sources get
     <include name="**/private_*"/>
   </dirset>
 </chmod>
-

makes cgi scripts, files with a .old extension or directories beginning -with private_ belong to the user named webadmin. A directory ending -in .old or a file beginning with private_ would remain unaffected.

diff --git a/manual/Tasks/clearcase.html b/manual/Tasks/clearcase.html index 7b0e480ca..932764560 100644 --- a/manual/Tasks/clearcase.html +++ b/manual/Tasks/clearcase.html @@ -118,17 +118,16 @@ problem.

Examples

+

Perform a ClearCase checkin on the file c:/views/viewdir/afile. Comment +text from the file acomment.txt is added to ClearCase as a comment. All warning +messages are suppressed. The file is checked in even if it is identical to the +original.

 <cccheckin viewpath="c:/views/viewdir/afile"
            commentfile="acomment.txt"
            nowarn="true"
            identical="true"/>
-

Does a ClearCase checkin on the file c:/views/viewdir/afile. Comment -text from the file acomment.txt is added to ClearCase as a comment. All warning -messages are suppressed. The file is checked in even if it is identical to the -original.

-

CCCheckout

@@ -200,6 +199,9 @@ original.

Examples

+

Perform a ClearCase checkout on the file c:/views/viewdir/afile. It is +checked out as reserved on branch called abranch. All warning messages are +suppressed. A "Some comment text" is added to ClearCase as a comment.

 <cccheckout viewpath="c:/views/viewdir/afile"
             reserved="true"
@@ -207,10 +209,6 @@ original.

nowarn="true" comment="Some comment text"/>
-

Does a ClearCase checkout on the file c:/views/viewdir/afile. It is -checked out as reserved on branch called abranch. All warning messages are -suppressed. A "Some comment text" is added to ClearCase as a comment.

-

CCUnCheckout

@@ -241,11 +239,10 @@ suppressed. A "Some comment text" is added to ClearCase a

Examples

+

Perform a ClearCase uncheckout on the file c:/views/viewdir/afile. A +copy of the file named c:/views/viewdir/afile.keep is kept.

<ccuncheckout viewpath="c:/views/viewdir/afile" keepcopy="true"/>
-

Does a ClearCase uncheckout on the file c:/views/viewdir/afile. A copy -of the file called c:/views/viewdir/afile.keep is kept.

-

CCUpdate

@@ -303,6 +300,10 @@ of the file called c:/views/viewdir/afile.keep is kept.

Examples

+

Perform a ClearCase update on the snapshot view +directory c:/views/viewdir. A graphical dialog will be displayed. The output will be +logged to log.log and it will overwrite any hijacked files. The modified time will be +set to the current time.

 <ccupdate viewpath="c:/views/viewdir"
           graphical="false"
@@ -311,11 +312,6 @@ of the file called c:/views/viewdir/afile.keep is kept.

currenttime="true" rename="false"/>
-

Does a ClearCase update on the snapshot view -directory c:/views/viewdir. A graphical dialog will be displayed. The output will be -logged to log.log and it will overwrite any hijacked files. The modified time will be -set to the current time.

-

CCMklbtype

@@ -382,15 +378,14 @@ set to the current time.

Examples

+

Perform a ClearCase mklbtype to create a label type named VERSION_1. It +is created as ordinary so it is available only to the current VOB. The text Development +version 1 is added as a comment.

 <ccmklbtype typename="VERSION_1"
             ordinary="true"
             comment="Development version 1"/>
-

Does a ClearCase mklbtype to create a label type named VERSION_1. It -is created as ordinary so it is available only to the current VOB. The text Development -version 1 is added as a comment.

-

CCMklabel

@@ -451,6 +446,9 @@ version 1 is added as a comment.

Examples

+

Perform a ClearCase mklabel on the file c:/views/viewdir/afile under +the main branch for version 2 (\main\2). Text "Some comment +text" is added as a comment. It will recurse all subdirectories.

 <ccmklabel viewpath="c:/views/viewdir/afile"
            comment="Some comment text"
@@ -459,10 +457,6 @@ version 1 is added as a comment.

typename="VERSION_1"/>
-

Does a ClearCase mklabel on the file c:/views/viewdir/afile under the -main branch for version 2 (\main\2). Text "Some comment text" is -added as a comment. It will recurse all subdirectories.

-

CCRmtype

@@ -544,16 +538,15 @@ added as a comment. It will recurse all subdirectories.

Examples

+

Perform a ClearCase rmtype to remove a label type (lbtype) +named VERSION_1. Comment text from the file acomment.txt is added as a +comment. All instances of the type are removed, including the type object itself.

 <ccrmtype typekind="lbtype"
           typename="VERSION_1"
           commentfile="acomment.txt"
           rmall="true"/>
-

Does a ClearCase rmtype to remove a label type (lbtype) -named VERSION_1. Comment text from the file acomment.txt is added as a -comment. All instances of the type are removed, including the type object itself.

-

CCLock

@@ -609,10 +602,9 @@ comment. All instances of the type are removed, including the type object itself

Examples

-
<cclock objsel="stream:Application_Integration@\MyProject_PVOB"/>
- -

Does a ClearCase lock on the +

Perform a ClearCase lock on the object stream:Application_Integration@\MyProject_PVOB.

+
<cclock objsel="stream:Application_Integration@\MyProject_PVOB"/>

@@ -654,10 +646,9 @@ object stream:Application_Integration@\MyProject_PVOB.

Examples

-
<ccunlock objsel="stream:Application_Integration@\MyProject_PVOB"/>
- -

Does a ClearCase unlock on the +

Perform a ClearCase unlock on the object stream:Application_Integration@\MyProject_PVOB.

+
<ccunlock objsel="stream:Application_Integration@\MyProject_PVOB"/>

@@ -713,16 +704,15 @@ object stream:Application_Integration@\MyProject_PVOB.

Examples

+

Perform a ClearCase mkbl on the Integration view at v:\ApplicationCC +even if it is identical to a previous baseline. The new baseline with be incremental and +named Application_Baseline_AUTO.

 <ccmkbl baselinerootname="Application_Baseline_AUTO"
         identical="yes"
         full="no"
         viewpath="v:\ApplicationCC"/>
-

Does a ClearCase mkbl on the Integration view at v:\ApplicationCC even -if it is identical to a previous baseline. The new baseline with be incremental and -named Application_Baseline_AUTO.

-

CCMkattr

@@ -783,15 +773,14 @@ named Application_Baseline_AUTO.

Examples

+

Perform a ClearCase mkattr on the file c:/views/viewdir/afile and +attach the attribute BugFix with a value of 34445 to it.

 <ccmkattr viewpath="c:/views/viewdir/afile"
           typename="BugFix"
           typevalue="34445"/>
 
-

Does a ClearCase mkattr on the file c:/views/viewdir/afile and attaches -the attribute BugFix with a value of 34445 to it.

-

CCMkdir

@@ -832,14 +821,13 @@ the attribute BugFix with a value of 34445 to it.

Examples

+

Perform a ClearCase mkdir on the dir c:/views/viewdir/adir and do not +automatically check it out.

 <ccmkdir viewpath="c:/views/viewdir/adir"
          nocheckout="true"
          comment="Some comment text"/>
-

Does a ClearCase mkdir on the dir c:/views/viewdir/adir and does not -automatically check it out.

-

CCMkelem

@@ -905,14 +893,13 @@ automatically check it out.

Examples

+

Perform ClearCase mkelem on the file c:/views/viewdir/afile with +element type text_file, check in the file after creation.

 <ccmkelem viewpath="c:/views/viewdir/afile"
           eltype="text_file"
           checkin="true"
           comment="Some comment text"/>
-

Does a ClearCase mkelem on the file c:/views/viewdir/afile with element -type text_file. It also checks in the file after creation.

- diff --git a/manual/Tasks/componentdef.html b/manual/Tasks/componentdef.html index 63d249398..557c1a56d 100644 --- a/manual/Tasks/componentdef.html +++ b/manual/Tasks/componentdef.html @@ -38,13 +38,13 @@ like and or or.

Examples

+

Define two components with the same name or; one is a +condition (see conditions) and one is a +selector (see selectors).

 <componentdef name="or" onerror="ignore"
               classname="com.apache.tools.ant.taskdefs.conditions.Or"/>
 <componentdef name="or" onerror="ignore"
               classname="com.apache.tools.ant.types.resources.selectors.Or"/>
-

defines two components with the same name or; one is a condition -(see conditions) and one is a selector -(see selectors).

diff --git a/manual/Tasks/concat.html b/manual/Tasks/concat.html index cccacc61d..b47234241 100644 --- a/manual/Tasks/concat.html +++ b/manual/Tasks/concat.html @@ -185,27 +185,23 @@

Examples

-

Concatenate a string to a file:

- +

Concatenate a string to a file:

<concat destfile="README">Hello, World!</concat>
-

Concatenate a series of files to the console:

- +

Concatenate a series of files to the console:

 <concat>
   <fileset dir="messages" includes="*important*"/>
 </concat>
-

Concatenate a single file, appending if the destination file exists:

- +

Concatenate a single file, appending if the destination file exists:

 <concat destfile="NOTES" append="true">
   <filelist dir="notes" files="note.txt"/>
 </concat>
-

Concatenate a series of files, update the destination file only if is older that all - the source files:

- +

Concatenate a series of files, update the destination file only if is older that all the + source files:

 <concat destfile="${docbook.dir}/all-sections.xml"
         force="no">
@@ -216,7 +212,7 @@
            excludes="introduction.xml,overview.xml"/>
 </concat>
-

Concatenate a series of files, expanding Ant properties

+

Concatenate a series of files, expanding Ant properties.

 <concat destfile="${build.dir}/subs">
   <path>
@@ -228,8 +224,8 @@
   </filterchain>
 </concat>
-

Filter the lines containing project from build.xml and output them to report.output, - prepending with a header

+

Filter the lines containing project from build.xml and output them + to report.output, prepending with a header.

 <concat destfile="${build.dir}/report.output">
   <header filtering="no" trimleading="yes">
@@ -244,7 +240,7 @@
   </filterchain>
 </concat>
-

Concatenate a number of binary files.

+

Concatenate a number of binary files.

 <concat destfile="${build.dir}/dist.bin" binary="yes">
   <fileset file="${src.dir}/scripts/dist.sh"/>
diff --git a/manual/Tasks/condition.html b/manual/Tasks/condition.html
index 7c12da4fa..25e438668 100644
--- a/manual/Tasks/condition.html
+++ b/manual/Tasks/condition.html
@@ -63,6 +63,9 @@ condition.

see here.

Examples

+ +

Set the property javamail.complete if both the JavaBeans Activation Framework and +JavaMail are available in the classpath.

 <condition property="javamail.complete">
   <and>
@@ -70,9 +73,9 @@ see here.

<available classname="javax.mail.Transport"/> </and> </condition>
-

sets the property javamail.complete if both the JavaBeans Activation Framework and -JavaMail are available in the classpath.

+

Set the property isMacOsButNotMacOsX if the current operating system is MacOS, but +not MacOS X/macOS—which Ant considers to be in the Unix family as well.

 <condition property="isMacOsButNotMacOsX">
   <and>
@@ -82,15 +85,13 @@ JavaMail are available in the classpath.

</not> </and> </condition>
-

sets the property isMacOsButNotMacOsX if the current operating system is MacOS, but -not MacOS X/macOS—which Ant considers to be in the Unix family as well.

+

Set the property isSunOSonSparc if the current operating system is SunOS and if it +is running on a SPARC architecture.

 <condition property="isSunOSonSparc">
   <os name="SunOS" arch="sparc"/>
 </condition>
-

sets the property isSunOSonSparc if the current operating system is SunOS and if it -is running on a SPARC architecture.

diff --git a/manual/Tasks/copy.html b/manual/Tasks/copy.html index 49b21b851..55160e1c3 100644 --- a/manual/Tasks/copy.html +++ b/manual/Tasks/copy.html @@ -183,17 +183,21 @@ the same <copy> task, all <filterchain> el first followed by <filterset> elements.

Examples

-

Copy a single file

+ +

Copy a single file

<copy file="myfile.txt" tofile="mycopy.txt"/>
-

Copy a single file to a directory

+ +

Copy a single file to a directory

<copy file="myfile.txt" todir="../some/other/dir"/>
-

Copy a directory to another directory

+ +

Copy a directory to another directory

 <copy todir="../new/dir">
   <fileset dir="src_dir"/>
 </copy>
 
-

Copy a set of files to a directory

+ +

Copy a set of files to a directory

 <copy todir="../dest/dir">
   <fileset dir="src_dir">
@@ -204,16 +208,17 @@ first followed by <filterset> elements.

<copy todir="../dest/dir"> <fileset dir="src_dir" excludes="**/*.java"/> </copy>
-

Copy a set of files to a directory, appending .bak to the file name on the -fly

+ +

Copy a set of files to a directory, appending .bak to the file name on the +fly

 <copy todir="../backup/dir">
   <fileset dir="src_dir"/>
   <globmapper from="*" to="*.bak"/>
 </copy>
-

Copy a set of files to a directory, replacing @TITLE@ with Foo -Bar in all files.

+

Copy a set of files to a directory, replacing @TITLE@ with Foo +Bar in all files.

 <copy todir="../backup/dir">
   <fileset dir="src_dir"/>
@@ -222,8 +227,8 @@ Bar in all files.

</filterset> </copy>
-

Collect all items from the current CLASSPATH setting into a destination -directory, flattening the directory structure.

+

Collect all items from the current CLASSPATH setting into a destination +directory, flattening the directory structure.

 <copy todir="dest" flatten="true">
   <path>
@@ -231,7 +236,7 @@ directory, flattening the directory structure.

</path> </copy>
-

Copies some resources to a given directory.

+

Copies some resources to a given directory.

 <copy todir="dest" flatten="true">
   <resources>
@@ -245,7 +250,7 @@ resource would have returned its full path as source and target name and would n
 at all.  In general it is a good practice to use an explicit mapper together with resources that use
 an absolute path as their names.

-

Copies the two newest resources into a destination directory.

+

Copies the two newest resources into a destination directory.

 <copy todir="dest" flatten="true">
   <first count="2">
diff --git a/manual/Tasks/copydir.html b/manual/Tasks/copydir.html
index 6609a2e96..84c73c727 100644
--- a/manual/Tasks/copydir.html
+++ b/manual/Tasks/copydir.html
@@ -102,26 +102,28 @@ and <patternset> elements.

Examples

+

Copy the directory ${src}/resources to ${dist}.

 <copydir src="${src}/resources"
          dest="${dist}"/>
-

copies the directory ${src}/resources to ${dist}.

+ +

Copy the directory ${src}/resources to ${dist} +recursively. All .java files are copied, except for files with the +name Test.java.

 <copydir src="${src}/resources"
          dest="${dist}"
          includes="**/*.java"
          excludes="**/Test.java"/>
-

copies the directory ${src}/resources to ${dist} -recursively. All .java files are copied, except for files with the -name Test.java.

+ +

Copy the directory ${src}/resources to ${dist} +recursively. All .java files are copied, except for the files under +the mypackage/test directory.

 <copydir src="${src}/resources"
          dest="${dist}"
          includes="**/*.java"
          excludes="mypackage/test/**"/>
-

copies the directory ${src}/resources to ${dist} -recursively. All .java files are copied, except for the files under -the mypackage/test directory.

diff --git a/manual/Tasks/cvs.html b/manual/Tasks/cvs.html index c8e5333f1..95f89711a 100644 --- a/manual/Tasks/cvs.html +++ b/manual/Tasks/cvs.html @@ -169,22 +169,23 @@ attribute can contain spaces in their name.

Examples

+ +

Check out the package/module ant from the CVS repository pointed to by +the cvsRoot attribute, and store the files in ${ws.dir}.

 <cvs cvsRoot=":pserver:anoncvs@cvs.apache.org:/home/cvspublic"
      package="ant"
      dest="${ws.dir}"/>
-

checks out the package/module ant from the CVS repository pointed to by -the cvsRoot attribute, and stores the files in ${ws.dir}.

+

Update the package/module that has previously been checked out into ${ws.dir}.

<cvs dest="${ws.dir}" command="update"/>
-

updates the package/module that has previously been checked out into ${ws.dir}.

+

Silently (-q) create a file called patch.txt containing a unified +(-u) diff which includes new files added via cvs add (-N) and can +be used as input to patch.

<cvs command="-q diff -u -N" output="patch.txt"/>
-

silently (-q) creates a file called patch.txt which contains a unified -(-u) diff which includes new files added via cvs add (-N) and -can be used as input to patch. The equivalent, using <commandline> -elements, is:

+

The equivalent, using <commandline> elements, is:

 <cvs output="patch">
     <commandline>
@@ -205,15 +206,15 @@ elements, is:

the failonerror, compression, and other "global" parameters from the <cvs> element.

-
  <cvs command="update -A -d"/>
-

Updates from the head of repository ignoring sticky bits (-A) and creating any new +

Update from the head of repository ignoring sticky bits (-A) and creating any new directories as necessary (-d).

-

Note: the text of the command is passed to cvs "as-is" so any cvs options -should appear before the command, and any command options should appear after the command as in the -diff example above. See the CVS -book for details, specifically +

<cvs command="update -A -d"/>
+

Note: the text of the command is passed to cvs "as-is" so any cvs +options should appear before the command, and any command options should appear after the command as +in the diff example above. See the CVS book for details, specifically the Guide -to CVS commands

+to CVS commands.

diff --git a/manual/Tasks/cvspass.html b/manual/Tasks/cvspass.html index abcb7d241..bdd744687 100644 --- a/manual/Tasks/cvspass.html +++ b/manual/Tasks/cvspass.html @@ -59,10 +59,10 @@ target="_top">bugzilla report 21657 for recommended workarounds.

Examples

+

Add an entry into the ~/.cvspass password file.

 <cvspass cvsroot=":pserver:anoncvs@cvs.apache.org:/home/cvspublic"
          password="anoncvs"/>
-

Adds an entry into the ~/.cvspass password file.

diff --git a/manual/Tasks/cvstagdiff.html b/manual/Tasks/cvstagdiff.html index dc9e66bc0..bc92d32e5 100644 --- a/manual/Tasks/cvstagdiff.html +++ b/manual/Tasks/cvstagdiff.html @@ -147,6 +147,9 @@ attribute can contain spaces in their name.

Examples

+

Generate a tagdiff report for all the changes that have been made in + the ant module between the tags ANT_14 + and ANT_141. Write these changes into the file tagdiff.xml.

 <cvstagdiff cvsRoot=":pserver:anoncvs@cvs.apache.org:/home/cvspublic"
             destfile="tagdiff.xml"
@@ -154,36 +157,31 @@ attribute can contain spaces in their name.

startTag="ANT_14" endTag="ANT_141"/>
-

Generates a tagdiff report for all the changes that have been made in -the ant module between the tags ANT_14 and ANT_141. It -writes these changes into the file tagdiff.xml.

- +

Generate a tagdiff report for all the changes that have been made in + the ant module in January 2002. Write the changes into the + file tagdiff.xml. In this example, cvsRoot has not been + set. The current cvsRoot will be used (assuming the build is started from a folder stored + in CVS.

 <cvstagdiff destfile="tagdiff.xml"
             package="ant"
             startDate="2002-01-01"
             endDate="2002-31-01"/>
-

Generates a tagdiff report for all the changes that have been made in -the ant module in January 2002. In this example cvsRoot has not been -set. The current cvsRoot will be used (assuming the build is started from a folder stored -in cvs. It writes these changes into the file tagdiff.xml.

- +

Generate a tagdiff report for all the changes that have been made in + the ant and jakarta-gump modules in January 2003. Write the changes into + the file tagdiff.xml. In this + example, cvsRoot has not been set. The current cvsRoot will be used (assuming + the build is started from a folder stored in CVS.

 <cvstagdiff destfile="tagdiff.xml"
             package="ant jakarta-gump"
             startDate="2003-01-01"
             endDate="2003-31-01"/>
-

Generates a tagdiff report for all the changes that have been made in -the ant and jakarta-gump modules in January 2003. In this -example cvsRoot has not been set. The current cvsRoot will be used (assuming -the build is started from a folder stored in cvs. It writes these changes into the -file tagdiff.xml.

-

Generate Report

-

Ant includes a basic XSLT stylesheet that you can use to generate a HTML report based on the xml -output. The following example illustrates how to generate a HTML report from the XML report.

+

Ant includes a basic XSLT stylesheet that you can use to generate a HTML report based on the XML +output. The following example illustrates how to generate an HTML report from the XML report.

 <style in="tagdiff.xml"
@@ -195,27 +193,31 @@ output. The following example illustrates how to generate a HTML report from the
 </style>

Output

-

The cvsroot and package attributes of the tagdiff element are -new in Ant 1.6.
Notes on entry attributes:

+

The cvsroot and package attributes of the <tagdiff> element are + added since Ant 1.6.

+ +

Description of <entry> attributes:

- + - + - +
Attribute Comment
namename when reporting on one package, the package name is removed from the output
revisionrevision supplied for files which exist at the end of the reporting period
prevrevisionprevrevision supplied for files which exist at the beginning of the reporting period.
Old CVS servers do not supply it for deleted files. CVS 1.12.2 supplies it.
+ +

Example:

 <?xml version="1.0" encoding="UTF-8"?>
 <tagdiff startTag="ANT_14" endTag="ANT_141"
diff --git a/manual/Tasks/cvsversion.html b/manual/Tasks/cvsversion.html
index 8d56a345b..510462f80 100644
--- a/manual/Tasks/cvsversion.html
+++ b/manual/Tasks/cvsversion.html
@@ -89,13 +89,14 @@
   
 
 

Examples

+ +

Find out the CVS client and server versions and store the versions in the properties +called apachecvsversion and localcvsversion

 <cvsversion cvsRoot=":pserver:anoncvs@cvs.apache.org:/home/cvspublic"
             passfile="/home/myself/.cvspass"
             serverversionproperty="apachecvsversion"
             clientversionproperty="localcvsversion"/>
-

finds out the CVS client and server versions and stores the versions in the properties -called apachecvsversion and localcvsversion

diff --git a/manual/Tasks/delete.html b/manual/Tasks/delete.html index 0ac5b77e9..ed4bb6e29 100644 --- a/manual/Tasks/delete.html +++ b/manual/Tasks/delete.html @@ -153,45 +153,46 @@ nested <fileset>.

Examples

+ +

Delete the file /lib/ant.jar.

<delete file="/lib/ant.jar"/>
-

deletes the file /lib/ant.jar.

-
<delete dir="lib"/>
-

deletes the lib directory, including all files and subdirectories +

Delete the lib directory, including all files and subdirectories of lib.

+
<delete dir="lib"/>
+

Delete all files with the extension .bak from the current directory and any +subdirectories.

 <delete>
   <fileset dir="." includes="**/*.bak"/>
 </delete>
 
-

deletes all files with the extension .bak from the current directory and any -subdirectories.

+

Delete all files and subdirectories of build, including build +itself.

 <delete includeEmptyDirs="true">
   <fileset dir="build"/>
 </delete>
 
-

deletes all files and subdirectories of build, including build -itself.

+

Delete all files and subdirectories of build, without build itself.

 <delete includeemptydirs="true">
   <fileset dir="build" includes="**/*"/>
 </delete>
 
-

deletes all files and subdirectories of build, without build -itself.

+

Delete the Subversion metadata directories under src. Because .svn is +on of the default excludes you have to use +the defaultexcludes flag, otherwise Ant won't delete these directories and the files in +it.

 <delete includeemptydirs="true">
   <fileset dir="src" includes="**/.svn/" defaultexcludes="false"/>
 </delete>
 
-

deletes the subversion metadata directories under src. Because .svn is -on of the default excludes you have to use the -defaultexcludes flag, otherwise Ant won't delete these directories and the files in it.

diff --git a/manual/Tasks/deltree.html b/manual/Tasks/deltree.html index 8e3bff7ac..994499bfb 100644 --- a/manual/Tasks/deltree.html +++ b/manual/Tasks/deltree.html @@ -43,10 +43,12 @@

Examples

+ +

Delete the directory dist, including its files and subdirectories.

<deltree dir="dist"/>
-

deletes the directory dist, including its files and subdirectories.

+ +

Delete the directory ${dist}, including its files and subdirectories.

<deltree dir="${dist}"/>
-

deletes the directory ${dist}, including its files and subdirectories.

diff --git a/manual/Tasks/depend.html b/manual/Tasks/depend.html index 01d0aa598..fe62cfe5b 100644 --- a/manual/Tasks/depend.html +++ b/manual/Tasks/depend.html @@ -83,7 +83,6 @@ relationship complexity and how many class files are out of date. The decision a cheaper to just recompile all classes or to use the depend task will depend on the size of your project and how interrelated your classes are.

-

Limitations

There are some source dependencies which depend will not detect.

@@ -170,18 +169,20 @@ as well as the nested <include>, <exclude> and <patternset> elements.

Examples

-
-<depend srcdir="${java.dir}"
-        destdir="${build.classes}"
-        cache="depcache"
-        closure="yes"/>
-

removes any classes in the ${build.classes} directory that depend on out-of-date +

Remove any classes in the ${build.classes} directory that depend on out-of-date classes. Classes are considered out-of-date with respect to the source in the ${java.dir} directory, using the same mechanism as the <javac> task. In this example, the <depend> task caches its dependency information in the depcache directory.

+
+<depend srcdir="${java.dir}"
+        destdir="${build.classes}"
+        cache="depcache"
+        closure="yes"/>
+

Do the same as the previous example, but explicitly include all .java files, except +those that match the list given in ${java.dir}/build_excludes.

 <depend srcdir="${java.dir}" destdir="${build.classes}"
         cache="depcache" closure="yes">
@@ -189,8 +190,5 @@ the depcache directory.

<excludesfile name="${java.dir}/build_excludes"/> </depend>
-

does the same as the previous example, but explicitly includes all .java files, -except those that match the list given in ${java.dir}/build_excludes.

- diff --git a/manual/Tasks/dependset.html b/manual/Tasks/dependset.html index ff043ee06..da98860fb 100644 --- a/manual/Tasks/dependset.html +++ b/manual/Tasks/dependset.html @@ -110,6 +110,15 @@ and <sourcefilelist> filelists, and if any are older, they ar Multiple <targetfilelist> filelists may be specified.

Examples

+ +

Remove derived HTML files in the ${output.dir} directory if they are out-of-date with respect +to:

+
    +
  1. the DTD of their source XML files
  2. +
  3. a common DTD (imported by the main DTD)
  4. +
  5. a subordinate XSLT stylesheet (imported by the main stylesheet), or
  6. +
  7. the buildfile
  8. +
 <dependset>
   <srcfilelist
@@ -126,17 +135,8 @@ Multiple <targetfilelist> filelists may be specified.

includes = "**/*.html"/> </dependset>
-

In this example derived HTML files in the ${output.dir} directory will be removed if any are -out-of-date with respect to:

-
    -
  1. the DTD of their source XML files
  2. -
  3. a common DTD (imported by the main DTD)
  4. -
  5. a subordinate XSLT stylesheet (imported by the main stylesheet), or
  6. -
  7. the buildfile
  8. -
- -

If any of the sources in the above example does not exist, all target files will also be removed. -To ignore missing sources instead, use filesets instead of filelists for the sources.

+

If any of the sources in the above example does not exist, all target files will also be +removed. To ignore missing sources instead, use filesets instead of filelists for the sources.

diff --git a/manual/Tasks/diagnostics.html b/manual/Tasks/diagnostics.html index 82f38496c..864339f0d 100644 --- a/manual/Tasks/diagnostics.html +++ b/manual/Tasks/diagnostics.html @@ -32,11 +32,11 @@ Ant's configuration under an IDE.

Examples

+

Print out the current diagnostics dump.

 <target name="diagnostics" description="diagnostics">
     <diagnostics/>
 </target>
-

Prints out the current diagnostics dump.

diff --git a/manual/Tasks/dirname.html b/manual/Tasks/dirname.html index 17671c49a..319edf594 100644 --- a/manual/Tasks/dirname.html +++ b/manual/Tasks/dirname.html @@ -54,11 +54,12 @@ full directory path of the specified file.

Examples

+ +

Set antfile.dir to the directory path for ${ant.file}.

<dirname property="antfile.dir" file="${ant.file}"/>
-

will set antfile.dir to the directory path for ${ant.file}.

+

Set foo.dirname to the project's basedir.

<dirname property="foo.dirname" file="foo.txt"/>
-

will set foo.dirname to the project's basedir.

diff --git a/manual/Tasks/ear.html b/manual/Tasks/ear.html index 60c1a698f..343c2dcb3 100644 --- a/manual/Tasks/ear.html +++ b/manual/Tasks/ear.html @@ -257,7 +257,7 @@ named MANIFEST.MF, the file is ignored and you will get a warning.<

manifest, indexjars, service

These are inherited from <jar>

-

Example

+

Example

 <ear destfile="${build.dir}/myapp.ear" appxml="${src.dir}/metadata/application.xml">
   <fileset dir="${build.dir}" includes="*.jar,*.war"/>
diff --git a/manual/Tasks/echo.html b/manual/Tasks/echo.html
index 49cab16ee..aece00a37 100644
--- a/manual/Tasks/echo.html
+++ b/manual/Tasks/echo.html
@@ -84,34 +84,38 @@ file is available, and the level option is ignored

Examples

+ +

Basic use:

<echo message="Hello, world"/>
<echo message="Embed a line break:${line.separator}"/>
<echo>Embed another:${line.separator}</echo>
<echo>This is a longer message stretching over
 two lines.
 </echo>
+ +

The newline immediately following the <echo> tag is part of the +output. Newlines in character data within the content of an element are not discarded by XML +parsers.
See W3C Recommendation +26 November 2008 / End of Line handling for more details.

<echo>
 This is a longer message stretching over
 three lines; the first line is a blank
 </echo>
-

The newline immediately following the <echo> tag will be part of the -output. Newlines in character data within the content of an element are not discarded by XML -parsers.
See W3C Recommendation -26 November 2008 / End of Line handling for more details.

-
<echo message="Deleting drive C:" level="debug"/>

A message which only appears in -debug mode.

+
<echo message="Deleting drive C:" level="debug"/>
+ +

A message which appears even in -quiet mode.

<echo level="error">
 Imminent failure in the antimatter containment facility.
 Please withdraw to safe location at least 50km away.
 </echo>
-

A message which appears even in -quiet mode.

+

Generate a shell script by echoing to a file. Note the use of a double $ symbol to stop +Ant filtering out the single $ during variable expansion.

<echo file="runner.csh" append="false">#\!/bin/tcsh
 java-1.3.1 -mx1024m ${project.entrypoint} $$*
 </echo>
-

Generate a shell script by echoing to a file. Note the use of a double $ symbol to stop -Ant filtering out the single $ during variable expansion.

Depending on the log level Ant runs at, messages are print out or silently ignored:

diff --git a/manual/Tasks/echoproperties.html b/manual/Tasks/echoproperties.html index 9373e3514..1ff3d7a11 100644 --- a/manual/Tasks/echoproperties.html +++ b/manual/Tasks/echoproperties.html @@ -86,27 +86,33 @@ more control on which properties will be picked up. The attributes prefixregex are just shortcuts that use propertysets internally.

Examples

-
<echoproperties/>

Report the current properties to the log.

+
<echoproperties/>
+ +

Report the current properties to the file my.properties, and fail the build if the +file could not be created or written to.

<echoproperties destfile="my.properties"/>
-

Report the current properties to the file my.properties, and will fail the build if -the file could not be created or written to.

+ +

Report the current properties to the file my.properties, and log a message if the +file could not be created or written to, but still allow the build to continue.

<echoproperties destfile="my.properties" failonerror="false"/>
-

Report the current properties to the file my.properties, and will log a message if -the file could not be created or written to, but will still allow the build to continue.

-
<echoproperties prefix="java."/>
+

List all properties beginning with java.

+
<echoproperties prefix="java."/>
+ +

Lists all properties beginning with java. using a +nested <propertyset/> which is an equivalent but longer way.

 <echoproperties>
   <propertyset>
     <propertyref prefix="java."/>
   </propertyset>
 </echoproperties>
-

This again lists all properties beginning with java. using a -nested <propertyset/> which is an equivalent but longer way.

+ +

Lists all properties that contain ant in their names.

<echoproperties regex=".*ant.*"/>
-

Lists all properties that contain ant in their names. The equivalent snippet -with <propertyset/> is:

+ +

The equivalent snippet with <propertyset/> is:

 <echoproperties>
   <propertyset>
diff --git a/manual/Tasks/echoxml.html b/manual/Tasks/echoxml.html
index b6a3fb54f..c2740bfb1 100644
--- a/manual/Tasks/echoxml.html
+++ b/manual/Tasks/echoxml.html
@@ -57,6 +57,8 @@
 

Nested XML content is required.

Examples

+ +

Create an Ant buildfile, subbuild.xml.

<echoxml file="subbuild.xml">
   <project default="foo">
     <target name="foo">
@@ -64,7 +66,6 @@
     </target>
   </project>
 </echoxml>
-

Creates an Ant buildfile, subbuild.xml.

diff --git a/manual/Tasks/exec.html b/manual/Tasks/exec.html index 87e2b3345..166dafd28 100644 --- a/manual/Tasks/exec.html +++ b/manual/Tasks/exec.html @@ -330,21 +330,24 @@ means it is not on the path. Any time you see such an error from any Ant task, i Ant bug, but some configuration problem on your machine.

Examples

+ +

Start emacs on display 1 of the X Window System.

 <exec executable="emacs">
   <env key="DISPLAY" value=":1.0"/>
 </exec>
 
-

starts emacs on display 1 of the X Window System.

+

Add ${basedir}/bin to the PATH of the system command.

 <property environment="env"/>
 <exec ... >
   <env key="PATH" path="${env.PATH}:${basedir}/bin"/>
 </exec>
 
-

adds ${basedir}/bin to the PATH of the system command.

+

Start the ${browser} with the specified ${file} and end the Ant +process. The browser will remain.

 <property name="browser" location="C:/Program Files/Internet Explorer/iexplore.exe"/>
 <property name="file" location="ant/docs/manual/index.html"/>
@@ -353,9 +356,12 @@ Ant bug, but some configuration problem on your machine.

<arg value="${file}"/> </exec>
-

Starts the ${browser} with the specified ${file} and end the Ant -process. The browser will remain.

+

Send the string blah before blah to the cat executable, using +an <inputfilterchain> to replace before +with after on the way in. Output is sent to the file redirector.out and stored +in a property of the same name. Similarly, error output is sent to a file and a property, both +named redirector.err.

 <exec executable="cat">
     <redirector outputproperty="redirector.out"
@@ -370,12 +376,6 @@ process. The browser will remain.

</exec>
-

Sends the string blah before blah to the cat executable, using -an <inputfilterchain> to replace before -with after on the way in. Output is sent to the file redirector.out and stored -in a property of the same name. Similarly, error output is sent to a file and a property, both -named redirector.err.

-

Note: do not try to specify arguments using a simple arg-element and separate them by spaces. This results in only a single argument containing the entire string.

diff --git a/manual/Tasks/fail.html b/manual/Tasks/fail.html index 7f67f051b..ac3fefde6 100644 --- a/manual/Tasks/fail.html +++ b/manual/Tasks/fail.html @@ -73,34 +73,34 @@ see here.
Since Ant 1.6.2

Examples

+

Exit the current build with no further information given.

<fail/>
-

will exit the current build with no further information given.

+
 BUILD FAILED
 
 build.xml:4: No message
+

Exit the current build and print a message to wherever your output goes:

<fail message="Something wrong here."/>
-

will exit the current build and print something like the following to wherever your output -goes:

+
 BUILD FAILED
 
 build.xml:4: Something wrong here.
+

A different way to achieve the same result as above.

<fail>Something wrong here.</fail>
-

will give the same result as above.

+

Exit the current build and print an explanation to wherever your output goes:

<fail unless="thisdoesnotexist"/>
-

will exit the current build and print something like the following to wherever your output -goes:

+
 BUILD FAILED
 
 build.xml:2: unless=thisdoesnotexist
-Using a condition to achieve the same effect: - +

Use a condition to achieve the same effect:

 <fail>
     <condition>
@@ -110,12 +110,13 @@ Using a condition to achieve the same effect:
     </condition>
 </fail>
-

Output:

 BUILD FAILED
 
 build.xml:2: condition satisfied
+

Check that both files one.txt and two.txt are present otherwise the +build will fail.

 <fail message="Files are missing.">
     <condition>
@@ -126,8 +127,6 @@ build.xml:2: condition satisfied
</not> </condition> </fail>
-

Will check that both files one.txt and two.txt are present otherwise -the build will fail.

diff --git a/manual/Tasks/filter.html b/manual/Tasks/filter.html index a6fe45e1b..419542ac2 100644 --- a/manual/Tasks/filter.html +++ b/manual/Tasks/filter.html @@ -57,17 +57,19 @@ incorrect tokens are ignored.

Examples

+ +

Copy recursively all the files from the src.dir directory into +the dest.dir directory replacing all the occurrences of the string @year@ +with 2000.

 <filter token="year" value="2000"/>
 <copy todir="${dest.dir}" filtering="true">
   <fileset dir="${src.dir}"/>
 </copy>
-

will copy recursively all the files from the src.dir directory into -the dest.dir directory replacing all the occurrences of the string @year@ -with 2000.

-
<filter filtersfile="deploy_env.properties"/>
-

will read all property entries from the deploy_env.properties file and set these as + +

Read all property entries from the deploy_env.properties file and set these as filters.

+
<filter filtersfile="deploy_env.properties"/>
diff --git a/manual/Tasks/fixcrlf.html b/manual/Tasks/fixcrlf.html index 06a2f6bb9..276d39388 100644 --- a/manual/Tasks/fixcrlf.html +++ b/manual/Tasks/fixcrlf.html @@ -208,38 +208,42 @@

Examples

+

Replace EOLs with LF characters and remove EOF characters from the shell scripts. Tabs and spaces +are left as is.

 <fixcrlf srcdir="${src}" includes="**/*.sh"
          eol="lf" eof="remove"/>
-

Replaces EOLs with LF characters and removes eof characters from the shell scripts. Tabs and -spaces are left as is.

+ +

Replace all EOLs with cr-lf pairs in the batch files. Tabs and spaces are left as is. EOF +characters are left alone if run on DOS systems, and are removed if run on Unix systems.

 <fixcrlf srcdir="${src}"
          includes="**/*.bat" eol="crlf"/>
-

Replaces all EOLs with cr-lf pairs in the batch files. Tabs and spaces are left as is. EOF -characters are left alone if run on DOS systems, and are removed if run on Unix systems.

+ +

Set EOLs according to local OS conventions, and convert sequences of spaces and tabs into the +minimal set of spaces and tabs which will preserve spacing within the line. Tabs are set at 8 +character intervals. EOF characters are left alone if run on DOS systems, and are removed if run on +Unix systems. Many versions of make require tabs prior to commands.

 <fixcrlf srcdir="${src}"
          includes="**/Makefile" tab="add"/>
-

Sets EOLs according to local OS conventions, and converts sequences of spaces and tabs to the -minimal set of spaces and tabs which will maintain spacing within the line. Tabs are set at 8 -character intervals. EOF characters are left alone if run on DOS systems, and are removed if run on -Unix systems. Many versions of make require tabs prior to commands.

+ +

Convert all EOLs in the included Java source files to a single LF. Replace all tab characters +except those in string or character constants with spaces, assuming a tab width of 3. If run on a +Unix system, any CTRL-Z EOF characters at the end of the file are removed. On DOS/Windows, any such +EOF characters will be left untouched. +

 <fixcrlf srcdir="${src}" includes="**/*.java"
          tab="remove" tablength="3"
          eol="lf" javafiles="yes"/>
-

Converts all EOLs in the included Java source files to a single LF. Replace all TAB characters -except those in string or character constants with spaces, assuming a tab width of 3. If run on a -Unix system, any CTRL-Z EOF characters at the end of the file are removed. On DOS/Windows, any such -EOF characters will be left untouched. -

+ +

Set EOLs according to local OS conventions, and convert all tabs to spaces, assuming a tab width +of 8. EOF characters are left alone if run on DOS systems, and are removed if run on Unix +systems. You never know what editor a user will use to browse READMEs.

 <fixcrlf srcdir="${src}"
          includes="**/README*" tab="remove"/>
-

Sets EOLs according to local OS conventions, and converts all tabs to spaces, assuming a tab -width of 8. EOF characters are left alone if run on DOS systems, and are removed if run on Unix -systems. You never know what editor a user will use to browse READMEs.

diff --git a/manual/Tasks/ftp.html b/manual/Tasks/ftp.html index e99358743..511887790 100644 --- a/manual/Tasks/ftp.html +++ b/manual/Tasks/ftp.html @@ -394,15 +394,19 @@ to false. On remote filesets hidden files are not checked for being Hidden files are currently assumed to not be symbolic links.

Sending files

-

The easiest way to describe how to send files is with a couple of examples:

+

The easiest way to describe how to send files is with a couple of examples.

+

Log in to ftp.apache.org as anonymous and upload all files in +the htdocs/manual directory to the default directory for that user.

 <ftp server="ftp.apache.org"
      userid="anonymous"
      password="me@myorg.com">
     <fileset dir="htdocs/manual"/>
 </ftp>
-

Logs in to ftp.apache.org as anonymous and uploads all files in -the htdocs/manual directory to the default directory for that user.

+ +

Log in to ftp.apache.org as anonymous and upload all new or changed +files in the htdocs/manual directory to the incoming directory relative to +the default directory for anonymous.

 <ftp server="ftp.apache.org"
      remotedir="incoming"
@@ -411,9 +415,12 @@ the htdocs/manual directory to the default directory for that user.
      depends="yes">
     <fileset dir="htdocs/manual"/>
 </ftp>
-

Logs in to ftp.apache.org as anonymous and uploads all new or changed -files in the htdocs/manual directory to the incoming directory relative to -the default directory for anonymous.

+ +

Log in to ftp.apache.org at port 2121 as coder with +password java1 and upload all new or changed HTML files in +the htdocs/manual directory to the /pub/incoming directory. The files are +transferred in text mode. Passive mode has been switched on to send files from behind a +firewall.

 <ftp server="ftp.apache.org"
      port="2121"
@@ -427,11 +434,11 @@ the default directory for anonymous.

<include name="**/*.html"/> </fileset> </ftp>
-

Logs in to ftp.apache.org at port 2121 as coder with -password java1 and uploads all new or changed HTML files in -the htdocs/manual directory to the /pub/incoming directory. The files are -transferred in text mode. Passive mode has been switched on to send files from behind a -firewall.

+ +

Log in to a Windows server at ftp.hypothetical.india.org at port 2121 +as coder with password java1 and upload all new or changed (accounting for +timezone differences) HTML files in the htdocs/manual directory to +the /pub/incoming directory. The files are transferred in text mode.

 <ftp server="ftp.hypothetical.india.org"
      port="2121"
@@ -446,10 +453,10 @@ firewall.

<include name="**/*.html"/> </fileset> </ftp>
-

Logs in to a Windows server at ftp.hypothetical.india.org at port 2121 -as coder with password java1 and uploads all new or changed (accounting -for timezone differences) HTML files in the htdocs/manual directory to -the /pub/incoming directory. The files are transferred in text mode.

+ +

Log in to the Windows-based ftp.nt.org as coder with +password java1 and upload all HTML files in the htdocs/manual directory to +the c:\uploads directory. Progress messages are displayed as each file is uploaded.

 <ftp server="ftp.nt.org"
      remotedir="c:\uploads"
@@ -461,15 +468,16 @@ the /pub/incoming directory. The files are transferred in text mode
         <include name="**/*.html"/>
     </fileset>
 </ftp>
-

Logs in to the Windows-based ftp.nt.org as coder with -password java1 and uploads all HTML files in the htdocs/manual directory -to the c:\uploads directory. Progress messages are displayed as each file is -uploaded.

+

Getting files

-

Getting files from an FTP server works pretty much the same way as sending them does. The only +

Getting files from an FTP server works pretty much the same way as sending them does. The only difference is that the nested filesets use the remotedir attribute as the base directory for the files on the FTP server, and the dir attribute as the local directory to put the -files into. The file structure from the FTP site is preserved on the local machine.

+files into. The file structure from the FTP site is preserved on the local machine.

+ +

Log in to ftp.apache.org as anonymous and recursively download +all .html files from default directory for that user into +the htdocs/manual directory on the local machine.

 <ftp action="get"
      server="ftp.apache.org"
@@ -479,9 +487,12 @@ files into.  The file structure from the FTP site is preserved on the local mach
         <include name="**/*.html"/>
     </fileset>
 </ftp>
-

Logs in to ftp.apache.org as anonymous and recursively downloads -all .html files from default directory for that user into -the htdocs/manual directory on the local machine.

+ +

If apache.org ever switches to a Unix FTP server that uses the new all-numeric +format for timestamps, this version would become necessary. It would accomplish the same +functionality as the previous example but would successfully handle the numeric +timestamps. The systemTypeKey is not necessary here but helps clarify what is going +on.

 <ftp action="get"
      server="ftp.apache.org"
@@ -493,10 +504,11 @@ the htdocs/manual directory on the local machine.

<include name="**/*.html"/> </fileset> </ftp>
-

If apache.org ever switches to a Unix FTP server that uses the new all-numeric -format for timestamps, this version would become necessary. It would accomplish the same -functionality as the previous example but would successfully handle the numeric timestamps. -The systemTypeKey is not necessary here but helps clarify what is going on.

+ +

Log into a UNIX FTP server at ftp.hypothetical.fr which displays dates with French +names in Standard European format, as anonymous, and recursively download +all .html files from default directory for that user into +the htdocs/manual directory on the local machine.

 <ftp action="get"
      server="ftp.hypthetical.fr"
@@ -509,16 +521,15 @@ The systemTypeKey is not necessary here but helps clarify what is goi
         <include name="**/*.html"/>
     </fileset>
 </ftp>
-

Logs into a UNIX FTP server at ftp.hypothetical.fr which displays dates with French -names in Standard European format, as anonymous, and recursively downloads -all .html files from default directory for that user into -the htdocs/manual directory on the local machine.

Deleting files

As you've probably guessed by now, you use nested fileset elements to select the files to delete from the remote FTP server. Again, the filesets are relative to the remote directory, not a local directory. In fact, the dir attribute of the fileset is ignored completely.

+

Log in to ftp.apache.org as anonymous and try to delete +all *.tmp files from the default directory for that user. If you don't have permission +to delete a file, a BuildException is thrown.

 <ftp action="del"
      server="ftp.apache.org"
@@ -528,10 +539,11 @@ directory.  In fact, the dir attribute of the fileset is ignored comp
         <include name="**/*.tmp"/>
     </fileset>
 </ftp>
-

Logs in to ftp.apache.org as anonymous and tries to delete -all *.tmp files from the default directory for that user. If you don't have permission -to delete a file, a BuildException is thrown.

+

Listing Files

+

Get a file listing in data/ftp.listing of all the files on the FTP server relative +to the default directory of the anonymous user. The listing is in whatever format the +FTP server normally lists files.

 <ftp action="list"
      server="ftp.apache.org"
@@ -542,30 +554,34 @@ to delete a file, a BuildException is thrown.

<include name="**"/> </fileset> </ftp>
-

This provides a file listing in data/ftp.listing of all the files on the FTP server -relative to the default directory of the anonymous user. The listing is in whatever -format the FTP server normally lists files.

Creating directories

Note that with the mkdir action, the directory to create is specified using the remotedir attribute.

+

Create the directory some/remote/dir beneath the default root directory. As with all +other actions, the directory separator character must be correct according to the desires of the FTP +server.

 <ftp action="mkdir"
      server="ftp.apache.org"
      userid="anonymous"
      password="me@myorg.com"
      remotedir="some/remote/dir"/>
-

This creates the directory some/remote/dir beneath the default root directory. As -with all other actions, the directory separator character must be correct according to the desires -of the FTP server.

+

Removing directories

This action uses nested fileset elements to select the directories to remove from the remote FTP -server. The filesets are relative to the remote directory, not a local directory. -The dir attribute of the fileset is ignored completely. The directories to be removed -must be empty, or contain only other directories that have been also selected to be removed by the -filesets patterns, otherwise a BuildException will be thrown. Also, if you don't have -permission to remove a directory, a BuildException is thrown.

+server. The filesets are relative to the remote directory, not a local directory. The dir +attribute of the fileset is ignored completely. The directories to be removed must be empty, or +contain only other directories that have been also selected to be removed by the filesets patterns, +otherwise a BuildException will be thrown. Also, if you don't have permission to remove +a directory, a BuildException is thrown.

+

Log in to ftp.apache.org as anonymous and try to +remove /somedir/dira directory and all the directory tree starting at, and +including, /somedir/dirb. When removing the /somedir/dirb tree, the task +starts at the leaves moving up to the root, so that when it tries to remove a directory it is sure +all the directories under it are already removed. Obviously all the files in the tree must have +been already deleted.

 <ftp action="rmdir"
      server="ftp.apache.org"
@@ -577,14 +593,8 @@ permission to remove a directory, a BuildException is thrown.

<include name="dirb/**"/> </fileset> </ftp>
-

Logs in to ftp.apache.org as anonymous and tries to -remove /somedir/dira directory and all the directories tree starting at, and -including, /somedir/dirb. When removing the /somedir/dirb tree, it will -start at the leaves moving up to the root, so that when it tries to remove a directory it is sure -all the directories under it are already removed. Obviously all the files in the tree must have -been already deleted.

-

As an example suppose you want to delete everything contained into /somedir, so -invoke first the <ftp> task with action=delete, then +

As an example suppose you want to delete everything contained in /somedir, so invoke +first the <ftp> task with action=delete, then with action=rmdir specifying in both cases remotedir=/somedir and

diff --git a/manual/Tasks/genkey.html b/manual/Tasks/genkey.html
index e98f7270f..14971471d 100644
--- a/manual/Tasks/genkey.html
+++ b/manual/Tasks/genkey.html
@@ -97,9 +97,8 @@ sub-element and populating it with <param> elements that have
 and a value. When using the subelement, it is automatically encoded properly and commas
 (,) are replaced with \,.

-

The following two examples are identical:

-

Examples

+

The following two examples are identical:

 <genkey alias="apache-group" storepass="secret"
         dname="CN=Ant Group, OU=Jakarta Division, O=Apache.org, C=US"/>
diff --git a/manual/Tasks/get.html b/manual/Tasks/get.html index 2f5bc0439..e345ea185 100644 --- a/manual/Tasks/get.html +++ b/manual/Tasks/get.html @@ -174,27 +174,28 @@ nested <header/> node are as follows:

Examples

-
<get src="http://ant.apache.org/" dest="help/index.html"/>
-

Gets the index page of http://ant.apache.org/, and stores it in the + +

Get the index page of http://ant.apache.org/, and store it in the file help/index.html.

+
<get src="http://ant.apache.org/" dest="help/index.html"/>
+

Get the PGP keys of Ant's (current and past) release managers, if the local copy is missing or +out of date. Use the verbose option for progress information.

 <get src="http://www.apache.org/dist/ant/KEYS"
      dest="KEYS"
      verbose="true"
      usetimestamp="true"/>
-

Gets the PGP keys of Ant's (current and past) release managers, if the local copy is missing or -out of date. Uses the verbose option for progress information.

+

Fetch some file from a server with access control. Because HTTPS is being used, the fact that +basic auth sends passwords in plaintext is moot if you ignore the fact that it is part of your build +file which may be readable by third parties. If you need more security, consider using +the input task to query for a password.

 <get src="https://insecure-bank.org/statement/user=1214"
      dest="statement.html"
      username="1214"
      password="secret"/>
-

Fetches some file from a server with access control. Because https is being used the fact that -basic auth sends passwords in plaintext is moot if you ignore the fact that it is part of your build -file which may be readable by third parties. If you need more security, consider using -the input task to query for a password.

Using a macro like the following

@@ -233,7 +234,7 @@ naming convention for the checksum file, of course) and validate the checksum on <url url="http://ant.apache.org/faq.html"/> </get>
-

With custom HTTP headers

+

Using custom HTTP headers

 <get src="http://ant.apache.org/index.html" dest="downloads">
@@ -242,7 +243,7 @@ naming convention for the checksum file, of course) and validate the checksum on
   <header name="header3" value="headerValue3"/>
 </get>
-

Gets the index and FAQ pages of http://ant.apache.org/, and stores them in the +

get the index and FAQ pages of http://ant.apache.org/, and store them in the directory downloads which will be created if necessary.

diff --git a/manual/Tasks/hostinfo.html b/manual/Tasks/hostinfo.html index df4c4b74d..7226a4ba3 100644 --- a/manual/Tasks/hostinfo.html +++ b/manual/Tasks/hostinfo.html @@ -68,17 +68,16 @@ build was performed on. The best place for this task is probably in an initiali

Examples

-
<hostinfo/>
- -

Sets the NAME, DOMAIN, ADDR4, and ADDR6 for +

Set the NAME, DOMAIN, ADDR4, and ADDR6 for the local host, using the most "global" address available.

+
<hostinfo/>
-
<hostinfo prefix="remotehost" host="www.apache.org"/>
-

Sets the properties remotehost.NAME +

Set the properties remotehost.NAME to eos, remotehost.DOMAIN to apache.org, remotehost.ADDR4 to 140.211.11.130 and remotehost.ADDR6 to :: for the host with the name www.apache.org (provided the canonical name and IP addresses do not change).

+
<hostinfo prefix="remotehost" host="www.apache.org"/>
diff --git a/manual/Tasks/image.html b/manual/Tasks/image.html index 519906496..ae6286131 100644 --- a/manual/Tasks/image.html +++ b/manual/Tasks/image.html @@ -209,6 +209,8 @@ element.

Examples

+

Create thumbnails of my images and make sure they all fit within the 160x160 size whether the +image is portrait or landscape.

 <image destdir="samples/low" overwrite="yes">
     <fileset dir="samples/full">
@@ -216,28 +218,27 @@ element.

</fileset> <scale width="160" height="160" proportions="fit"/> </image>
-

Create thumbnails of my images and make sure they all fit within the 160x160 size whether the -image is portrait or landscape.

+

Create a thumbnail for all PNG files in src of the size of 40 pixel keeping the +proportions and store the src.

 <image srcdir="src" includes="*.png">
     <scale proportions="width" width="40"/>
 </image>
-

Creates a thumbnail for all PNG files in src of the size of 40 pixel keeping the -proportions and stores the src.

+

Same as above but store the result in dest.

 <image srcdir="src" destdir="dest" includes="*.png">
     <scale proportions="width" width="40"/>
 </image>
-

Same as above but stores the result in dest.

+

Same as above but store the result to files with original names prefixed +by scaled-.

 <image srcdir="src" destdir="dest" includes="*.png">
     <scale proportions="width" width="40"/>
     <globmapper from="*" to="scaled-*"/>
 </image>
-

Same as above but stores the resulting file names will be prefixed by scaled-.

diff --git a/manual/Tasks/input.html b/manual/Tasks/input.html index b847c1c65..b7b5989bb 100644 --- a/manual/Tasks/input.html +++ b/manual/Tasks/input.html @@ -137,16 +137,22 @@ different Input tasks.

elements.

Examples

-
<input/>
-

Will pause the build run until return key is pressed when using +

Pause the build run until return key is pressed when using the default InputHandler, the concrete behavior is defined by the InputHandler implementation you use.

+
<input/>
+ +

Display the message Press Return key to continue... and pause the build run until return +key is pressed (again, the concrete behavior is implementation dependent).

<input>Press Return key to continue...</input>
-

Will display the message Press Return key to continue... and pause the build run until -return key is pressed (again, the concrete behavior is implementation dependent).

+ +

Display the message Press Return key to continue... and pause the build run until return +key is pressed (see above).

<input message="Press Return key to continue..."/>
-

Will display the message Press Return key to continue... and pause the build run until -return key is pressed (see above).

+ +

Display the message All data is going to be deleted from DB continue (y/n)? and +require y to continue build or n to exit build with following message Build aborted +by user..

 <input message="All data is going to be deleted from DB continue (y/n)?"
        validargs="y,n"
@@ -156,21 +162,19 @@ return key is pressed (see above).

</condition> <fail if="do.abort">Build aborted by user.</fail>
-

Will display the message All data is going to be deleted from DB continue (y/n)? and -require y to continue build or n to exit build with following message Build aborted -by user..

+ +

Display the message Please enter db-username: and set the property db.user to +the value entered by the user.

 <input message="Please enter db-username:"
        addproperty="db.user"/>
-

Will display the message Please enter db-username: and set the -property db.user to the value entered by the user.

+

Same as above, but set db.user to the value Scott-Tiger if the user enters no +value (simply presses return).

 <input message="Please enter db-username:"
        addproperty="db.user"
        defaultvalue="Scott-Tiger"/>
-

Same as above, but will set db.user to the value Scott-Tiger if the user -enters no value (simply presses return).

diff --git a/manual/Tasks/jar.html b/manual/Tasks/jar.html index 4df78e45b..c30785d55 100644 --- a/manual/Tasks/jar.html +++ b/manual/Tasks/jar.html @@ -388,45 +388,47 @@ nested <provider> elements may be used.

Examples

Simple

-
<jar destfile="${dist}/lib/app.jar" basedir="${build}/classes"/>
-

jars all files in the ${build}/classes directory into a file +

Jar all files in the ${build}/classes directory into a file called app.jar in the ${dist}/lib directory.

+
<jar destfile="${dist}/lib/app.jar" basedir="${build}/classes"/>

With filters

+

Jar all files in the ${build}/classes directory into a file +called app.jar in the ${dist}/lib directory. Files with the +name Test.class are excluded.

<jar destfile="${dist}/lib/app.jar"
      basedir="${build}/classes"
      excludes="**/Test.class"/>
-

jars all files in the ${build}/classes directory into a file -called app.jar in the ${dist}/lib directory. Files with the -name Test.class are excluded.

+

Jar all files in the ${build}/classes directory into a file +called app.jar in the ${dist}/lib directory. Only files under the +directory mypackage/test are used, and files with the name Test.class are +excluded.

 <jar destfile="${dist}/lib/app.jar"
      basedir="${build}/classes"
      includes="mypackage/test/**"
      excludes="**/Test.class"/>
-

jars all files in the ${build}/classes directory into a file -called app.jar in the ${dist}/lib directory. Only files under the -directory mypackage/test are used, and files with the name Test.class are -excluded.

Multiple filesets

+

Jar all files in the ${build}/classes directory and also in +the ${src}/resources directory together into a file called app.jar in +the ${dist}/lib directory. Files with the name Test.class are excluded. If +there are files such as ${build}/classes/mypackage/MyClass.class +and ${src}/resources/mypackage/image.gif, they will appear in the same directory in the +jar (and thus be considered in the same package by Java).

 <jar destfile="${dist}/lib/app.jar">
     <fileset dir="${build}/classes"
              excludes="**/Test.class"/>
     <fileset dir="${src}/resources"/>
 </jar>
-

jars all files in the ${build}/classes directory and also in -the ${src}/resources directory together into a file called app.jar in -the ${dist}/lib directory. Files with the name Test.class are excluded. -If there are files such as ${build}/classes/mypackage/MyClass.class -and ${src}/resources/mypackage/image.gif, they will appear in the same directory in the -JAR (and thus be considered in the same package by Java).

Merging archives

+

Create an executable jar file with a main class com.acme.checksites.Main, and embed +all the classes from the jar lib/main/some.jar.

 <jar destfile="build/main/checksites.jar">
     <fileset dir="build/main/classes"/>
@@ -436,9 +438,9 @@ JAR (and thus be considered in the same package by Java).

value="com.acme.checksites.Main"/> </manifest> </jar>
-

Creates an executable jar file with a main class com.acme.checksites.Main, and -embeds all the classes from the jar lib/main/some.jar.

+

Create an executable jar file with a main class com.acme.checksites.Main, and embed +all the classes from all the jars in lib/main.

 <jar destfile="build/main/checksites.jar">
     <fileset dir="build/main/classes"/>
@@ -455,8 +457,6 @@ embeds all the classes from the jar lib/main/some.jar.

value="com.acme.checksites.Main"/> </manifest> </jar>
-

Creates an executable jar file with a main class com.acme.checksites.Main, and -embeds all the classes from all the jars in lib/main.

Inline manifest

@@ -521,9 +521,9 @@ JDK 6 scripting interface:

JEP 238 example: a Multi-Release JAR Files

Here we want to create a Multi-Release JAR File according the -specification JEP 238. It defines on +specification JEP 238. It defines on top of a JAR the possibility to place additional or overwriting classes in a jar, which are -available according to the Java version you run.
Basically it says, that you have to set the +available according to the Java version you run.
Basically it says, that you have to set the manifest entry Multi-Release: true and place all additional or overwriting classes in META-INF/versions/number/package-structure, e.g. META-INF/versions/9/org/apache/ant/MyClass.class

diff --git a/manual/Tasks/jarlib-available.html b/manual/Tasks/jarlib-available.html index 9122c999f..6fe1c3203 100644 --- a/manual/Tasks/jarlib-available.html +++ b/manual/Tasks/jarlib-available.html @@ -69,7 +69,7 @@ extension.

extension in.

Examples

-

Search for extension in single file

+

Search for extension in single file

 <jarlib-available property="myext.present" file="myfile.jar">
   <extension extensionName="org.apache.tools.ant"
@@ -78,7 +78,7 @@ extension in.

</jarlib-available>
-

Search for extension in single file referencing external Extension

+

Search for extension in single file referencing external Extension

 <extension id="myext"
            extensionName="org.apache.tools.ant"
@@ -88,7 +88,8 @@ extension in.

<jarlib-available property="myext.present" file="myfile.jar"> <extension refid="myext"/> </jarlib-available>
-

Search for extension in fileset

+ +

Search for extension in fileset

 <extension id="myext"
            extensionName="org.apache.tools.ant"
@@ -101,7 +102,8 @@ extension in.

<include name="*.jar"/> </fileset> </jarlib-available>
-

Search for extension in extensionSet

+ +

Search for extension in extensionSet

 <extension id="myext"
            extensionName="org.apache.tools.ant"
@@ -121,4 +123,3 @@ extension in.

- diff --git a/manual/Tasks/jarlib-display.html b/manual/Tasks/jarlib-display.html index c5ee3a4ba..8d78957ec 100644 --- a/manual/Tasks/jarlib-display.html +++ b/manual/Tasks/jarlib-display.html @@ -56,10 +56,10 @@ target="_top">Extension and ExtensionSet documentation for further details.< information about.

Examples

-

Display Extension info for a single file

+

Display Extension info for a single file

<jarlib-display file="myfile.jar">
-

Display Extension info for a fileset

+

Display Extension info for a fileset

 <jarlib-display>
   <fileset dir="lib">
diff --git a/manual/Tasks/jarlib-manifest.html b/manual/Tasks/jarlib-manifest.html
index 490d20449..a5ab9b626 100644
--- a/manual/Tasks/jarlib-manifest.html
+++ b/manual/Tasks/jarlib-manifest.html
@@ -63,7 +63,7 @@ target="_top">Extension and ExtensionSet documentation for further details.<
 jar. (Optional dependencies will be used if present else they will be ignored)

Examples

-

Basic Manifest generated for single Extension

+

Basic Manifest generated for single Extension

 <extension id="e1"
            extensionName="MyExtensions"
@@ -78,8 +78,7 @@ jar. (Optional dependencies will be used if present else they will be ignored)
 
-

Search for extension in fileset

-

A large example with required and optional dependencies

+

Search for extension in fileset: a large example with required and optional dependencies

 <extension id="e1"
            extensionName="MyExtensions"
diff --git a/manual/Tasks/jarlib-resolve.html b/manual/Tasks/jarlib-resolve.html
index b60f83b2b..e21df8d6a 100644
--- a/manual/Tasks/jarlib-resolve.html
+++ b/manual/Tasks/jarlib-resolve.html
@@ -135,8 +135,8 @@ library.

Examples

-

Resolve Extension to file. If file does not exist or file does not implement -extension then throw an exception.

+

Resolve Extension to file. If file does not exist or file does not implement extension then throw +an exception.

 <extension id="dve.ext"
            extensionName="org.realityforge.dve"
@@ -148,8 +148,8 @@ extension then throw an exception.

<location location="/opt/jars/dve.jar"/> </jarlib-resolve>
-

Resolve Extension to URL. If URL does not exist or can not write -to destfile or file does not implement extension then throw an exception.

+

Resolve Extension to URL. If URL does not exist or can not write to destfile or file +does not implement extension then throw an exception.

 <extension id="dve.ext"
            extensionName="org.realityforge.dve"
@@ -161,9 +161,9 @@ to destfile or file does not implement extension then throw an except
   <url url="http://www.realityforge.net/jars/dve.jar" destfile="lib/dve.jar"/>
 </jarlib-resolve>
-

Resolve Extension to file produce by Ant build. If file does not get produced or -Ant file is missing or build fails then throw an exception. (Note: does not check -that library implements extension.)

+

Resolve Extension to file produce by Ant build. If file does not get produced or Ant file is +missing or build fails then throw an exception. (Note: does not check that library +implements extension.)

 <extension id="dve.ext"
            extensionName="org.realityforge.dve"
@@ -175,10 +175,9 @@ that library implements extension.)

<ant antfile="../dve/build.xml" target="main" destfile="lib/dve.jar"/> </jarlib-resolve>
-

Resolve Extension via multiple methods. First check local file to see if it -implements extension. If it does not then try to build it from source in parallel directory. If that -fails then finally try to download it from a website. If all steps fail then throw a build -exception.

+

Resolve Extension via multiple methods. First check local file to see if it implements +extension. If it does not then try to build it from source in parallel directory. If that fails then +finally try to download it from a website. If all steps fail then throw a build exception.

 <extension id="dve.ext"
            extensionName="org.realityforge.dve"
diff --git a/manual/Tasks/java.html b/manual/Tasks/java.html
index 8c40730a4..2cf434b3b 100644
--- a/manual/Tasks/java.html
+++ b/manual/Tasks/java.html
@@ -315,6 +315,7 @@ to Oracle's specification.
 
 

Examples

+

Run a class in this JVM with a new jar on the classpath

 <java classname="test.Main">
   <arg value="-h"/>
@@ -323,8 +324,10 @@ target="_top">Oracle's specification.
     <pathelement path="${java.class.path}"/>
   </classpath>
 </java>
-Run a class in this JVM with a new jar on the classpath +

Run the JAR test.jar in this project's dist/lib directory, using the +manifest supplied entry point, forking (as required), and with a maximum memory of 128 MB. Any non +zero return code breaks the build.

 <java jar="dist/test.jar"
       fork="true"
@@ -336,10 +339,9 @@ Run a class in this JVM with a new jar on the classpath
     <pathelement path="${java.class.path}"/>
   </classpath>
 </java>
-

Run the JAR test.jar in this project's dist/lib directory. using the -manifest supplied entry point, forking (as required), and with a maximum memory of 128 MB. Any non -zero return code breaks the build.

+

Run the JAR dist/test.jar relative to the directory ${exec.dir}, this +being the same directory in which JVM is to start up.

 <java dir="${exec.dir}"
       jar="${exec.dir}/dist/test.jar"
@@ -352,12 +354,12 @@ zero return code breaks the build.

<pathelement path="${java.class.path}"/> </classpath> </java>
-

Run the JAR dist/test.jar relative to the directory ${exec.dir}, this -being the same directory in which JVM is to start up.

+

Run a given class with the current classpath.

<java classname="test.Main"/>
-

Runs a given class with the current classpath.

+

Add system properties and JVM properties to JVM as in java +-Xrunhprof:cpu=samples,file=log.txt,depth=3 -DDEBUG=true test.Main

 <java classname="test.Main"
       fork="yes" >
@@ -365,31 +367,31 @@ being the same directory in which JVM is to start up.

<arg value="-h"/> <jvmarg value="-Xrunhprof:cpu=samples,file=log.txt,depth=3"/> </java>
-

Add system properties and JVM properties to JVM as in java --Xrunhprof:cpu=samples,file=log.txt,depth=3 -DDEBUG=true test.Main +

Use a given Java implementation (other than the one Ant is currently using) to run the class. For +documentation in the log taskname is used to change the [java] log-prefix +to [java1.4].

 <java classname="ShowJavaVersion" classpath="."
       jvm="path-to-java14-home/bin/java" fork="true"
       taskname="java1.4"/>
-

Use a given Java implementation (other than the one Ant is currently using) to run the class. -For documentation in the log taskname is used to change the [java] log-prefix -to [java1.4].

Note: you can not specify the (highly deprecated) MS JVM, jview.exe, as jvm, since it takes different parameters than other JVMs. That JVM can be started from <exec> if required.

+

Run the module TestModule resolved on the modulepath lib/:dist/test.jar +with a maximum memory of 128 MB. Any non zero return code breaks the build.

 <java fork="true"
       failonerror="true"
       maxmemory="128m"
       module="TestModule"
       modulepath="lib:dist/test.jar"/>
-

Runs the module TestModule resolved on the + +

Run the class Main in module TestModule resolved on the modulepath lib/:dist/test.jar with a maximum memory of 128 MB. Any non zero return code breaks the build.

-
 <java fork="true"
       failonerror="true"
@@ -401,8 +403,5 @@ breaks the build.

<pathelement location="dist/test.jar"/> </modulepath> </java>
-

Runs the class Main in module TestModule resolved on the -modulepath lib/:dist/test.jar with a maximum memory of 128 MB. Any non zero return code -breaks the build.

diff --git a/manual/Tasks/javac.html b/manual/Tasks/javac.html index f4dd3f414..55845e4e5 100644 --- a/manual/Tasks/javac.html +++ b/manual/Tasks/javac.html @@ -488,6 +488,10 @@ type can be used as an alternative to the compiler attribute.

Examples

+

Compile all .java files under the ${src} directory, and store +the .class files in the ${build} directory. The classpath used +includes xyz.jar, and compiling with debug information is on. The source level +is 1.4, so you can use assert statements.

 <javac srcdir="${src}"
        destdir="${build}"
@@ -495,11 +499,10 @@ type can be used as an alternative to the compiler attribute.

debug="on" source="1.4"/>
-

compiles all .java files under the ${src} directory, and stores -the .class files in the ${build} directory. The classpath used -includes xyz.jar, and compiling with debug information is on. The source level -is 1.4, so you can use assert statements.

- +

Compile all .java files under the ${src} directory, and store +the .class files in the ${build} directory. Java compiler is forked using +the default javac executable. The source level is 1.2 (similar to 1.1 +or 1.3) and the class files should be runnable under JDK 1.2+ as well.

 <javac srcdir="${src}"
        destdir="${build}"
@@ -507,50 +510,34 @@ is 1.4, so you can use assert statements.

source="1.2" target="1.2"/>
-

compiles all .java files under the ${src} directory, and stores -the .class files in the ${build} directory. This will fork off the Java -compiler using the default javac executable. The source level is 1.2 (similar -to 1.1 or 1.3) and the class files should be runnable under JDK 1.2+ as well.

- +

Compile all .java files under the ${src} directory, and store +the .class files in the ${build} directory. Java compiler is forked using +the executable named java$javac.exe. Note that the $ sign needs to be escaped by a +second one. The source level is 1.5, so you can use generics.

 <javac srcdir="${src}"
        destdir="${build}"
        fork="java$$javac.exe"
        source="1.5"/>
-

compiles all .java files under the ${src} directory, and stores -the .class files in the ${build} directory. This will fork off the Java -compiler, using the executable named java$javac.exe. Note that the $ sign needs -to be escaped by a second one. The source level is 1.5, so you can use generics.

- -
-<javac srcdir="${src}"
-       destdir="${build}"
-       includes="mypackage/p1/**,mypackage/p2/**"
-       excludes="mypackage/p1/testpackage/**"
-       classpath="xyz.jar"
-       debug="on"/>
- -

compiles .java files under the ${src} directory, and stores -the .class files in the ${build} directory. The classpath used -includes xyz.jar, and debug information is on. Only files +

Compile .java files under the ${src} directory, and store +the .class files in the ${build} directory. The classpath used +includes xyz.jar, and debug information is on. Only files under mypackage/p1 and mypackage/p2 are used. All files in and below -the mypackage/p1/testpackage directory are excluded from compilation. You didn't +the mypackage/p1/testpackage directory are excluded from compilation. You didn't specify a source or target level, so the actual values used will depend on which JDK you ran Ant with.

-
-<javac srcdir="${src}:${src2}"
+<javac srcdir="${src}"
        destdir="${build}"
        includes="mypackage/p1/**,mypackage/p2/**"
        excludes="mypackage/p1/testpackage/**"
        classpath="xyz.jar"
        debug="on"/>
-

is the same as the previous example, with the addition of a second source path, defined by the -property src2. This can also be represented using nested <src> +

This is the same as the previous example, with the addition of a second source path, defined by +the property src2. This can also be represented using nested <src> elements as follows:

-
 <javac destdir="${build}"
        classpath="xyz.jar"
@@ -562,11 +549,10 @@ elements as follows:

<exclude name="mypackage/p1/testpackage/**"/> </javac>
-

If you want to run the javac compiler of a different JDK, you should tell Ant, where -to find the compiler and which version of JDK you will be using so it can choose the correct command -line switches. The following example executes a JDK 1.1 javac in a new process and -uses the correct command line switches even when Ant is running in a JVM of a different version:

- +

If you want to run the javac compiler of a different JDK, you should tell Ant where to +find the compiler and which version of JDK you will be using so it can choose the correct command +line switches. The following example executes a JDK 1.1 javac in a new process and uses +the correct command line switches even when Ant is running in a JVM of a different version:

 <javac srcdir="${src}"
        destdir="${build}"
@@ -584,7 +570,6 @@ target="_top">Ant FAQ for additional information.

If you wish to compile only files explicitly specified and disable javac's default searching mechanism then you can unset the sourcepath attribute:

-
 <javac sourcepath="" srcdir="${src}"
        destdir="${build}" >
@@ -599,7 +584,6 @@ files refers to them.

If you wish to compile with a special JDK (another than the one Ant is currently using), set the executable and fork attribute. Using taskname could show in the log, that these settings are fix.

-
 <javac srcdir=""
        destdir=""
@@ -613,7 +597,6 @@ with all JDKs prior to 1.2.

If you want to activate other compiler options like lint you could use the <compilerarg> element:

-
 <javac srcdir="${src.dir}"
        destdir="${classes.dir}"
@@ -641,6 +624,12 @@ the compiler attribute:

in which case your compiler adapter can support attributes and nested elements of its own.

+

The following examples demonstrate the use of Java 9+ modules.

+ +

Compile all .java files in a single module under the ${src} directory, +and store the .class files in the ${build} directory. The compilation uses +application modules located in modules folder. The source level is 9 to enable +modules.

 <javac srcdir="${src}"
        destdir="${build}"
@@ -648,11 +637,14 @@ the compiler attribute:

modulepath="modules" source="9"/>
-

compiles all .java files in a single module under the ${src} directory, -and stores the .class files in the ${build} directory. The compilation -uses application modules located in modules folder.The source level is 9 to -enable modules.

- +

Compile all .java files in gen/classes, lin32/classes +and lin64/classes in all source modules under the ${src} +directory. Generate module directories in the ${build} directory. Each generated module +directory under the ${build} directory contains .class files from +corresponding source module. The * is a token representing the name of any of the +modules in the compilation module set. The { ... , ... } express alternates for +expansion. The compilation uses application modules located in modules folder. The +source level is 9 to enable modules.

 <javac modulesourcepath="${src}/*/{gen,lin{32,64}}/classes"
        destdir="${build}"
@@ -660,15 +652,6 @@ enable modules.

modulepath="modules" source="9"/>
-

compiles all .java files in gen/classes, lin32/classes -and lin64/classes in all source modules under the ${src} directory. -Generates module directories in the ${build} directory. Each generated module directory -under the ${build} directory contains .class files from corresponding -source module. The * is a token representing the name of any of the modules in the -compilation module set. The { ... , ... } express alternates for expansion. The -compilation uses application modules located in modules folder.The source level -is 9 to enable modules.

-

Jikes notes

You need Jikes 1.15 or later.

diff --git a/manual/Tasks/javacc.html b/manual/Tasks/javacc.html index 4507aa43a..7d83077f2 100644 --- a/manual/Tasks/javacc.html +++ b/manual/Tasks/javacc.html @@ -179,14 +179,14 @@ task will still work, but it will always generate the output files.

Example

+ +

Invoke JavaCC on grammar file src/Parser.jj, writing the generated files +to build/src. The grammar option STATIC is set to true when invoking JavaCC.

 <javacc target="src/Parser.jj"
         outputdirectory="build/src"
         javacchome="c:/program files/JavaCC"
         static="true"/>
-

This invokes JavaCC on grammar file src/Parser.jj, writing the generated files -to build/src. The grammar option STATIC is set to true when invoking -JavaCC.

diff --git a/manual/Tasks/javah.html b/manual/Tasks/javah.html index 0b5c0e884..2d1b39e08 100644 --- a/manual/Tasks/javah.html +++ b/manual/Tasks/javah.html @@ -188,25 +188,31 @@ using one of the built-in compilers.

element of that type can be used as an alternative to the implementation attribute.

Examples

-
<javah destdir="c" class="org.foo.bar.Wibble"/>
-

makes a JNI header of the named class, using the JDK 1.2 JNI model. Assuming the +

Make a JNI header of the named class, using the JDK 1.2 JNI model. Assuming the directory c already exists, the file org_foo_bar_Wibble.h is created there. If this file already exists, it is left unchanged.

+
<javah destdir="c" class="org.foo.bar.Wibble"/>
+ +

This is similar to the previous example, except the output is written to a file +called wibble.h in the current directory.

 <javah outputFile="wibble.h">
   <class name="org.foo.bar.Wibble,org.foo.bar.Bobble"/>
 </javah>
-

is similar to the previous example, except the output is written to a file -called wibble.h in the current directory.

+ +

Write three header files, one for each of the classes named. Because the force option +is set, these header files are always written when the Javah task is invoked, even if +they already exist.

 <javah destdir="c" force="yes">
   <class name="org.foo.bar.Wibble"/>
   <class name="org.foo.bar.Bobble"/>
   <class name="org.foo.bar.Tribble"/>
 </javah>
-

writes three header files, one for each of the classes named. Because the force option is set, -these header files are always written when the Javah task is invoked, even if they -already exist.

+ +

Write the headers for the three classes using the 'old' JNI format, then write the +corresponding .c stubs. The verbose option will cause Javah to +describe its progress.

 <javah destdir="c" verbose="yes" old="yes" force="yes">
   <class name="org.foo.bar.Wibble"/>
@@ -218,9 +224,6 @@ already exist.

<class name="org.foo.bar.Bobble"/> <class name="org.foo.bar.Tribble"/> </javah>
-

writes the headers for the three classes using the 'old' JNI format, then writes the -corresponding .c stubs. The verbose option will cause Javah to -describe its progress.

If you want to use a custom JavahAdapter org.example.MyAdapter you can either use diff --git a/manual/Tasks/jdepend.html b/manual/Tasks/jdepend.html index ef72bfbee..ed125695c 100644 --- a/manual/Tasks/jdepend.html +++ b/manual/Tasks/jdepend.html @@ -119,6 +119,8 @@ or above).

Examples

+

Invoke JDepend on the build directory, writing the output on the standard +output. The classpath is defined using a reference.

 <jdepend classpathref="base.path">
     <classespath>
@@ -126,9 +128,9 @@ or above).

</classespath> </jdepend>
-

This invokes JDepend on the build directory, writing the output on the standard -output. The classpath is defined using a classpath reference.

- +

This invoke JDepend in a separate JVM on the src and testsrc +directories, writing the output to the docs/jdepend.xml file in XML format. The +classpath is defined using nested elements.

 <jdepend outputfile="docs/jdepend.xml" fork="yes" format="xml">
     <sourcespath>
@@ -140,10 +142,8 @@ output. The classpath is defined using a classpath reference.

</classpath> </jdepend>
-

This invokes JDepend in a separate JVM on the src and testsrc -directories, writing the output to the docs/jdepend.xml file in xml format. The -classpath is defined using nested elements.

- +

Invoke JDepend with the build directory as the base for class files to analyze, and ignore all +classes in the java.* and javax.* packages.

 <jdepend classpathref="base.path">
     <exclude name="java.*>
@@ -153,8 +153,5 @@ classpath is defined using nested elements.

</classespath> </jdepend>
-

This invokes JDepend with the build directory as the base for class files to analyze, and will -ignore all classes in the java.* and javax.* packages.

- diff --git a/manual/Tasks/jjdoc.html b/manual/Tasks/jjdoc.html index a202ea836..4e9527761 100644 --- a/manual/Tasks/jjdoc.html +++ b/manual/Tasks/jjdoc.html @@ -87,13 +87,13 @@ documentation file.

Example

+

Invoke JJDoc on grammar file src/Parser.jj, writing the generated BNF documentation +file, ParserBNF.html, to doc.

+
 <jjdoc target="src/Parser.jj"
        outputfile="doc/ParserBNF.html"
        javacchome="c:/program files/JavaCC"/>
-

This invokes JJDoc on grammar file src/Parser.jj, writing the generated BNF -documentation file, ParserBNF.html, to doc.

- diff --git a/manual/Tasks/jjtree.html b/manual/Tasks/jjtree.html index b73664ff7..ac1f1fcd0 100644 --- a/manual/Tasks/jjtree.html +++ b/manual/Tasks/jjtree.html @@ -141,25 +141,24 @@ file as the JJTree grammar file with a suffix .jj.

No - - maxmemory - Max amount of memory to allocate to the forked JVM. since Ant 1.8.3 - No - + + maxmemory + Max amount of memory to allocate to the forked JVM. since Ant 1.8.3 + No +

Example

+

Invoke JJTree on grammar file src/Parser.jjt, writing the generated grammar +file, Parser.jj, to build/src. The grammar option NODE_USES_PARSER is set +to true when invoking JJTree.

 <jjtree target="src/Parser.jjt"
         outputdirectory="build/src"
         javacchome="c:/program files/JavaCC"
         nodeusesparser="true"/>
-

This invokes JJTree on grammar file src/Parser.jjt, writing the generated grammar -file, Parser.jj, file to build/src. The grammar option NODE_USES_PARSER is -set to true when invoking JJTree.

-

Comparison of output locations between command line JJTree and different Ant taskdef versions

diff --git a/manual/Tasks/jlink.html b/manual/Tasks/jlink.html index 69f420f50..3b22ce4fd 100644 --- a/manual/Tasks/jlink.html +++ b/manual/Tasks/jlink.html @@ -123,7 +123,7 @@ entries to out.jar.

</jar>
-

Suppose the file foo.jar contains two entries: bar.class +

Suppose the file foo.jar contains two entries: bar.class and barnone/myClass.zip. Suppose the path for file foo.jar is build/tempbuild/foo.jar. The following example will provide the entry tempbuild/foo.jar in the out.jar.

diff --git a/manual/Tasks/jspc.html b/manual/Tasks/jspc.html index 6b68a24b6..11f75f8e6 100644 --- a/manual/Tasks/jspc.html +++ b/manual/Tasks/jspc.html @@ -213,7 +213,11 @@ checking to the compiler.

Yes +

Example

+

Build all .jsp files under src/war into the +destination /gensrc, in a package hierarchy beginning +with com.i3sp.jsp.

 <jspc srcdir="${basedir}/src/war"
       destdir="${basedir}/gensrc"
@@ -222,9 +226,10 @@ checking to the compiler.

verbose="9"> <include name="**/*.jsp"/> </jspc>
-

Build all .jsp files under src/war into the -destination /gensrc, in a package hierarchy beginning -with com.i3sp.jsp.

+ +

Generate .java files from .jsp files, then javac them down +to bytecode. Include lib/taglibs.jar in the Java compilation. Dependency checking is +used to scrub the .java files if class dependencies indicate it is needed.

 <jspc destdir="interim"
       verbose="1"
@@ -241,9 +246,6 @@ with com.i3sp.jsp.

destdir="build" classpath="lib/taglibs.jar" debug="on"/>
-

Generate .java files from .jsp files then javac them down -to bytecodes. Include lib/taglibs.jar in the Java compilation. Dependency checking is -used to scrub the .java files if class dependencies indicate it is needed.

Notes

Using the package attribute it is possible to identify the diff --git a/manual/Tasks/junit.html b/manual/Tasks/junit.html index a83f57d93..06497689e 100644 --- a/manual/Tasks/junit.html +++ b/manual/Tasks/junit.html @@ -630,24 +630,29 @@ can ensure they will be generated even if the build file disables them.

Examples

+

Run the test defined in my.test.TestCase in the same VM. No output will be generated +unless the test fails.

 <junit>
     <test name="my.test.TestCase"/>
 </junit>
-

Runs the test defined in my.test.TestCase in the same VM. No output will be -generated unless the test fails.

- +

Run the test defined in my.test.TestCase in a separate JVM. At the end of the test, +a one-line summary will be printed. A detailed report of the test can be found +in TEST-my.test.TestCase.txt. The build process will be stopped if the test fails.

 <junit printsummary="yes" fork="yes" haltonfailure="yes">
     <formatter type="plain"/>
     <test name="my.test.TestCase"/>
 </junit>
-

Runs the test defined in my.test.TestCase in a separate JVM. At the end of the -test, a one-line summary will be printed. A detailed report of the test can be found -in TEST-my.test.TestCase.txt. The build process will be stopped if the test fails.

- +

Run my.test.TestCase in the same JVM, ignoring the given CLASSPATH; +only a warning is printed if this test fails. In addition to the plain text test results, for this +test a XML result will be output to result.xml. Then, for each matching file in the +directory defined for ${src.tests}, a test is run in a separate JVM. If a test fails, +the build process is aborted. Results are collected in files +named TEST-name.txt and written +to ${reports.tests}.

 <junit printsummary="yes" haltonfailure="yes">
     <classpath>
@@ -669,14 +674,14 @@ in TEST-my.test.TestCase.txt. The build process will be stopped if
     </batchtest>
 </junit>
-

Runs my.test.TestCase in the same JVM, ignoring the given CLASSPATH; -only a warning is printed if this test fails. In addition to the plain text test results, for this -test a XML result will be output to result.xml. Then, for each matching file in the -directory defined for ${src.tests} a test is run in a separate JVM. If a test fails, -the build process is aborted. Results are collected in files -named TEST-name.txt and written -to ${reports.tests}.

- +

On the first run, all tests are collected via the <batchtest/> +element. Its plain formatter shows the output on the console. The failure +formatter creates a Java source file in ${build.dir}/failingTests/FailedTests.java +which extends junit.framework.TestCase and returns from +a suite() method a test suite for the failing tests.
On a second run +the collector class exists and instead of the <batchtest/> the +single <test/> will run. So only the failing test cases are re-run. The two +nested formatters are for displaying (for the user) and for updating the collector class.

 <target name="test">
     <property name="collector.dir" value="${build.dir}/failingTests"/>
@@ -708,14 +713,17 @@ to ${reports.tests}.

</test> </junit> </target>
-

On the first run all tests are collected via the <batchtest/> -element. Its plain formatter shows the output on the console. The failure -formatter creates a Java source file in ${build.dir}/failingTests/FailedTests.java -which extends junit.framework.TestCase and returns from a suite() method a -test suite for the failing tests.
On a second run the collector class exists and instead of -the <batchtest/> the single <test/> will run. So only the -failing test cases are re-run. The two nested formatters are for displaying (for the user) and for -updating the collector class.

+ +

Run my.test.TestCase as a white-box test in the forked JVM given by +the platform.java property. The JUnit library is a part of an unnamed module while the +tested project and required modules are on the module path. The tests do not have module-info file +and are executed in the project module given by module.name +property.
The --patch-module Java option executes the tests built +into ${build.test.classes} in a module given by module.name +property.
The --add-modules Java option enables the tested +module.
The --add-reads Java option makes the unnamed module containing JUnit +readable by tested module.
The --add-exports Java option makes the non-exported test +package my.test accessible from the unnamed module containing JUnit.

 <junit fork="true"
        jvm="${platform.java}">
@@ -731,18 +739,15 @@ updating the collector class.

</modulepath> <formatter type="plain"/> <test name="my.test.TestCase"/> -</junit> -
-

Runs my.test.TestCase as a white-box test in the forked JVM given by -the platform.java property. The JUnit library is a part of an unnamed module while the -tested project and required modules are on the module path. The tests do not have module-info file -and are executed in the project module given by module.name property.
-The --patch-module Java option executes the tests built -into ${build.test.classes} in a module given by module.name property.
-The --add-modules Java option enables the tested module.
-The --add-reads Java option makes the unnamed module containing JUnit readable by -tested module.
The --add-exports Java option makes the non-exported test -package my.test accessible from the unnamed module containing JUnit.

+</junit>
+ +

Run my.test.TestCase as a black-box test in the forked JVM given by +the platform.java property. The JUnit library is used as an automatic module. The +tests' module-info requires the tested module and JUnit.
The --add-modules Java +option enables the test module.
The --add-exports Java option makes the non-exported +test package my.test accessible from the JUnit module and Ant's test runner. Another +possibility is to export the test package in the tests' module-info by exports my.test +directive.

 <junit fork="true"
        jvm="${platform.java}">
@@ -753,14 +758,6 @@ package my.test accessible from the unnamed module containing JUnit
     </modulepath>
     <formatter type="plain"/>
     <test name="my.test.TestCase"/>
-</junit>
-
-

Runs my.test.TestCase as a black-box test in the forked JVM given by -the platform.java property. The JUnit library is used as an automatic module. The -tests' module-info requires the tested module and JUnit.
The --add-modules Java -option enables the test module.
The --add-exports Java option makes the -non-exported test package my.test accessible from the JUnit module and Ant's test -runner. Another possibility is to export the test package in the tests' module-info -by exports my.test directive.

+</junit>
diff --git a/manual/Tasks/junitlauncher.html b/manual/Tasks/junitlauncher.html index 16bcee177..4639ead5d 100644 --- a/manual/Tasks/junitlauncher.html +++ b/manual/Tasks/junitlauncher.html @@ -392,6 +392,10 @@

Examples

+

+ Launch the JUnit 5 platform to run the org.myapp.SimpleTest test +

+
 <path id="test.classpath">
     ...
@@ -403,7 +407,9 @@
 </junitlauncher>

- Launches the JUnit 5 platform to run the org.myapp.SimpleTest test + Launch the JUnit 5 platform to run the org.myapp.SimpleTest and + the org.myapp.AnotherTest tests. The build process will be stopped if any test, in + the org.myapp.SimpleTest, fails.

@@ -415,9 +421,8 @@
 

- Launches the JUnit 5 platform to run the org.myapp.SimpleTest and - the org.myapp.AnotherTest tests. The build process will be stopped if any test, in - the org.myapp.SimpleTest, fails. + Launch the JUnit 5 platform to run only the testFoo and testBar + methods of the org.myapp.SimpleTest test class.

@@ -427,8 +432,10 @@
 </junitlauncher>

- Launches the JUnit 5 platform to run only the testFoo and testBar - methods of the org.myapp.SimpleTest test class. + Select any .class files that match + the org/example/**/tests/**/ fileset filter, under + the ${build.classes.dir} and passes those classes to the JUnit 5 platform for + execution as tests.

@@ -443,10 +450,14 @@
 </junitlauncher>

- Selects any .class files that match + Select any .class files that match the org/example/**/tests/**/ fileset filter, under - the ${build.classes.dir} and passes those classes to the JUnit 5 platform for - execution as tests. + the ${build.classes.dir} and pass those classes to the JUnit 5 platform for + execution as tests. Test results will be written out to the ${output.dir} by + the legacy-xml and legacy-plain formatters, in separate files. Furthermore, both + the legacy-xml and the legacy-plain listeners, above, are configured to receive + the standard output content generated by the tests. The legacy-xml listener is configured + to receive standard error content as well.

@@ -461,16 +472,6 @@
         <listener type="legacy-plain" sendSysOut="true" />
     </testclasses>
 </junitlauncher>
-

- Selects any .class files that match - the org/example/**/tests/**/ fileset filter, under - the ${build.classes.dir} and passes those classes to the JUnit 5 platform for - execution as tests. Test results will be written out to the ${output.dir} by - the legacy-xml and legacy-plain formatters, in separate files. Furthermore, both - the legacy-xml and the legacy-plain listeners, above, are configured to receive - the standard output content generated by the tests. The legacy-xml listener is - configured to receive standard error content as well. -

diff --git a/manual/Tasks/junitreport.html b/manual/Tasks/junitreport.html index c81c2cf69..0b78a661c 100644 --- a/manual/Tasks/junitreport.html +++ b/manual/Tasks/junitreport.html @@ -177,7 +177,11 @@ nested <classpath> will be used to load the processor.

Since Ant 1.9.5. Like for the XSLT task, a nested <factory> can be used to specify factory settings.

-

Example of report

+

Examples

+ +

Generate a TESTS-TestSuites.xml file in the directory reports and +generate the default framed report in the directory report/html.

+
 <junitreport todir="./reports">
     <fileset dir="./reports">
@@ -186,10 +190,9 @@ nested <factory> can be used to specify factory settings.

<report format="frames" todir="./report/html"/> </junitreport>
-

would generate a TESTS-TestSuites.xml file in the directory reports and -generate the default framed report in the directory report/html.

+

This example requires a file called junitreport/junit-frames.xsl. The XSL +parameters key1 and key2 will be passed to the XSL transformation.

-

Example of report with XSL params

 <junitreport todir="${outputdir}">
     <fileset dir="${jrdir}">
@@ -203,8 +206,5 @@ generate the default framed report in the directory report/html.

-

This example requires a file called junitreport/junit-frames.xsl. The XSL -parameters key1 and key2 will be passed to the XSL transformation.

- diff --git a/manual/Tasks/length.html b/manual/Tasks/length.html index 9a902520a..80eaa9b37 100644 --- a/manual/Tasks/length.html +++ b/manual/Tasks/length.html @@ -100,27 +100,27 @@ collections.

Examples

+

Store the length of the string foo in the property named length.foo.

<length string="foo" property="length.foo"/>
-

Stores the length of the string foo in the property named length.foo.

+

Store the length of file bar in the property named length.bar.

<length file="bar" property="length.bar"/>
-

Stores the length of file bar in the property named length.bar.

+

Store the file paths of foo and bar and their length into the +property length.

 <length property="length" mode="each">
     <fileset dir="." includes="foo,bar"/>
 </length>
 
-

Writes the file paths of foo and bar and their length into the -property length.

+

Add the length of foo and bar and store the result in +property length.

 <length property="length" mode="all">
     <fileset dir="." includes="foo,bar"/>
 </length>
 
-

Adds the length of foo and bar and stores the result in -property length.

diff --git a/manual/Tasks/loadfile.html b/manual/Tasks/loadfile.html index 81a2899a9..8e3b43c7b 100644 --- a/manual/Tasks/loadfile.html +++ b/manual/Tasks/loadfile.html @@ -71,28 +71,32 @@ is not set.

The LoadFile task supports nested FilterChains.

Examples

+

Load file message.txt into property message; +an <echo> can print this.

 <loadfile property="message"
           srcFile="message.txt"/>
-

Load file message.txt into property message; an <echo> can print -this. This is identical to

+ +

The above is identical to

 <loadresource property="message">
     <file file="message.txt"/>
 </loadresource>
+

Load a file using the Latin-1 encoding

 <loadfile property="encoded-file"
           srcFile="loadfile.xml"
           encoding="ISO-8859-1"/>
-

Load a file using the Latin-1 encoding

+

Load a file, don't fail if it is missing (a message is printed, though)

 <loadfile property="optional.value"
           srcFile="optional.txt"
           failonerror="false"/>
-

Load a file, don't fail if it is missing (a message is printed, though)

+

Load a property which can be used as a parameter for another task (in this +case mail), merging lines to ensure this happens.

 <loadfile property="mail.recipients"
           srcFile="recipientlist.txt">
@@ -100,9 +104,9 @@ this.  This is identical to

<striplinebreaks/> </filterchain> </loadfile>
-

Load a property which can be used as a parameter for another task (in this -case mail), merging lines to ensure this happens.

+

Load an XML file into a property, expanding all properties declared in the file in the +process.

 <loadfile property="system.configuration.xml"
           srcFile="configuration.xml">
@@ -110,8 +114,6 @@ case mail), merging lines to ensure this happens.

<expandproperties/> </filterchain> </loadfile>
-

Load an XML file into a property, expanding all properties declared in the file in the -process.

diff --git a/manual/Tasks/loadproperties.html b/manual/Tasks/loadproperties.html index e0721b2ed..06d993894 100644 --- a/manual/Tasks/loadproperties.html +++ b/manual/Tasks/loadproperties.html @@ -96,14 +96,17 @@ resource collection

for use with the resource attribute.

Examples

+ +

Load contents of file.properties as Ant properties.

<loadproperties srcFile="file.properties"/>

or

 <loadproperties>
     <file file="file.properties"/>
 </loadproperties>
-

Load contents of file.properties as Ant properties.

+

Read the lines that contain the string import. from the file file.properties +and load them as Ant properties.

 <loadproperties srcFile="file.properties">
     <filterchain>
@@ -112,17 +115,15 @@ resource collection
         </linecontains>
     </filterchain>
 </loadproperties>
-

Read the lines that contain the string import. from the file file.properties -and load them as Ant properties.

+

Load contents of http://example.org/url.properties.gz, uncompress it on the fly and +load the contents as Ant properties.

 <loadproperties>
     <gzipresource>
         <url url="http://example.org/url.properties.gz"/>
     </gzipresource>
 </loadproperties>
-

Load contents of http://example.org/url.properties.gz, uncompress it on the fly and -load the contents as Ant properties.

diff --git a/manual/Tasks/loadresource.html b/manual/Tasks/loadresource.html index 2e274af25..d9737c853 100644 --- a/manual/Tasks/loadresource.html +++ b/manual/Tasks/loadresource.html @@ -70,12 +70,13 @@ the property is not set.

The LoadResource task supports nested FilterChains.

Examples

+ +

Load the entry point of Ant's homepage into property homepage; +an <echo> can print this.

 <loadresource property="homepage">
     <url url="http://ant.apache.org/index.html"/>
 </loadresource>
-

Load the entry point of Ant's homepage into property homepage; -an <echo> can print this.

For more examples see the loadfile task.

diff --git a/manual/Tasks/mail.html b/manual/Tasks/mail.html index d09600479..5a8b83a3e 100644 --- a/manual/Tasks/mail.html +++ b/manual/Tasks/mail.html @@ -274,14 +274,21 @@ or more nested header elements:

Examples

+

Send an email from me to you with a subject of Results of nightly build and +include the contents of the file build.log in the body of the message.

+
 <mail from="me"
       tolist="you"
       subject="Results of nightly build"
       files="build.log"/>
-

Sends an email from me to you with a subject of Results of nightly build and -includes the contents of the file build.log in the body of the message.

+

Send an email from config@myisp.com to all@xyz.com with a subject of Test +Build. Replies to this email will go to me@myisp.com. Any zip files from +the dist directory are attached. The task will attempt to use JavaMail and fall back to +UU encoding or no encoding in that order depending on what support classes are +available. ${buildname} will be replaced with the buildname property's +value.

 <mail mailhost="smtp.myisp.com" mailport="1025" subject="Test build">
@@ -296,12 +303,8 @@ includes the contents of the file build.log in the body of the mess
   </attachments>
 </mail>
-

Sends an eMail from config@myisp.com to all@xyz.com with a subject of Test -Build. Replies to this email will go to me@myisp.com. Any zip files from -the dist directory are attached. The task will attempt to use JavaMail and fall back to -UU encoding or no encoding in that order depending on what support classes are -available. ${buildname} will be replaced with the buildname property's -value.

+

Send an email from me@myisp.com to all@xyz.com with a subject of Test Build, +the message body being coded in UTF-8.

 <property name="line2" value="some_international_message"/>
@@ -313,8 +316,5 @@ value.

<message>some international text:${line2}</message> </mail>
-

Sends an eMail from me@myisp.com to all@xyz.com with a subject of Test -Build, the message body being coded in UTF-8. - diff --git a/manual/Tasks/makeurl.html b/manual/Tasks/makeurl.html index c53f004d6..5d9b66509 100644 --- a/manual/Tasks/makeurl.html +++ b/manual/Tasks/makeurl.html @@ -71,14 +71,17 @@ them.

path (org.apache.tools.ant.types.Path)

Add a path to the URL. All elements in the path will be converted to individual URL entries.

+

Examples

-
<makeurl file="${user.home}/.m2/repository" property="m2.repository.url"/>
-

Sets the property m2.repository.url to the file: URL of the local Maven2 + +

Set the property m2.repository.url to the file: URL of the local Maven2 repository.

+
<makeurl file="${user.home}/.m2/repository" property="m2.repository.url"/>
+ +

Set the property codebase to the three URLs of the files provided as nested +elements.

<makeurl property="codebase">
   <fileset dir="lib includes="*.jar"/>
 </makeurl>
-

Set the property codebase to the three URLs of the files provided as nested -elements.

diff --git a/manual/Tasks/manifest.html b/manual/Tasks/manifest.html index e11d306f3..77983321b 100644 --- a/manual/Tasks/manifest.html +++ b/manual/Tasks/manifest.html @@ -131,6 +131,13 @@ sections.

Examples

+

Create or replace the file MANIFEST.MF. Note that the Built-By +attribute will take the value of the Ant property ${user.name}. The same is true for +the ${version} and ${TODAY} properties. This example produces +a MANIFEST.MF that +contains package version identification for the package common.

+
 <manifest file="MANIFEST.MF">
   <attribute name="Built-By" value="${user.name}"/>
@@ -147,13 +154,6 @@ sections.

</section> </manifest>
-

Creates or replaces the file MANIFEST.MF. Note that the Built-By -attribute will take the value of the Ant property ${user.name}. The same is true for -the ${version} and ${TODAY} properties. This example produces -a MANIFEST.MF that -contains package version identification for the package common.

-

The manifest produced by the above would look like this:

diff --git a/manual/Tasks/manifestclasspath.html b/manual/Tasks/manifestclasspath.html
index 0035515c4..a5fa1a1a3 100644
--- a/manual/Tasks/manifestclasspath.html
+++ b/manual/Tasks/manifestclasspath.html
@@ -84,15 +84,17 @@ a path defined elsewhere using the <classpath refid="pathid"/
 This classpath must not be empty, and is required.

Examples

+ +

Assuming a path with id=classpath was already defined, convert this path +relatively to the build/ directory that will contain acme.jar, which can +later be created with <jar> with a nested <manifest> element +that lists an <attribute name="Class-Path" value="${jar.classpath}"/>.

+
 <manifestclasspath property="jar.classpath"
                    jarfile="build/acme.jar">
     <classpath refid="classpath"/>
 </manifestclasspath>
-

Assuming a path with id classpath was already defined, convert this path -relatively to the build/ directory that will contain acme.jar, which can -later be created with <jar> with a nested <manifest> element -that lists an <attribute name="Class-Path" value="${jar.classpath}"/>.

diff --git a/manual/Tasks/mimemail.html b/manual/Tasks/mimemail.html index f55863a8c..0d24dc9c4 100644 --- a/manual/Tasks/mimemail.html +++ b/manual/Tasks/mimemail.html @@ -92,11 +92,12 @@ Activation Framework are required for this task.

Examples

-

Send a single HTML file as the body of a message

+

Send a single HTML file as the body of a message

 <mimemail messageMimeType="text/html" messageFile="overview-summary.html"
           tolist="you" subject="JUnit Test Results: ${TODAY}" from="me"/>
-

Sends all files in a directory as attachments

+ +

Send all files in a directory as attachments

 <mimemail message="See attached files" tolist="you" subject="Attachments" from="me">
     <fileset dir=".">
diff --git a/manual/Tasks/mkdir.html b/manual/Tasks/mkdir.html
index 5a8be43e1..b33c7a1d9 100644
--- a/manual/Tasks/mkdir.html
+++ b/manual/Tasks/mkdir.html
@@ -41,11 +41,14 @@ nothing if the directory already exist.

Yes +

Examples

+ +

Create a directory ${dist}.

<mkdir dir="${dist}"/>
-

creates a directory ${dist}.

+ +

Create a directory ${dist}/lib.

<mkdir dir="${dist}/lib"/>
-

creates a directory ${dist}/lib.

diff --git a/manual/Tasks/move.html b/manual/Tasks/move.html index 895bc13d1..2547485fa 100644 --- a/manual/Tasks/move.html +++ b/manual/Tasks/move.html @@ -169,18 +169,21 @@ the same <move> task, all <filterchain> el first followed by <filterset> elements.

Examples

-

Move a single file (rename a file)

+

Move a single file (rename a file)

<move file="file.orig" tofile="file.moved"/>
-

Move a single file to a directory

+ +

Move a single file to a directory

<move file="file.orig" todir="dir/to/move/to"/>
-

Move a directory to a new directory

+ +

Move a directory to a new directory

 <move todir="new/dir/to/move/to">
   <fileset dir="src/dir"/>
 </move>

or, since Ant 1.6.3:

<move file="src/dir" tofile="new/dir/to/move/to"/>
-

Move a set of files to a new directory

+ +

Move a set of files to a new directory

 <move todir="some/new/dir">
   <fileset dir="my/src/dir">
@@ -188,7 +191,8 @@ first followed by <filterset> elements.

<exclude name="**/ant.jar"/> </fileset> </move>
-

Move a list of files to a new directory

+ +

Move a list of files to a new directory

 <move todir="some/new/dir">
   <filelist dir="my/src/dir">
@@ -196,8 +200,8 @@ first followed by <filterset> elements.

<file name="file2.txt"/> </filelist> </move>
-

Append ".bak" to the names of all files in a -directory.

+ +

Append ".bak" to the names of all files in a directory.

 <move todir="my/src/dir" includeemptydirs="false">
   <fileset dir="my/src/dir">
diff --git a/manual/Tasks/native2ascii.html b/manual/Tasks/native2ascii.html
index 4d8f23106..09717c8b0 100644
--- a/manual/Tasks/native2ascii.html
+++ b/manual/Tasks/native2ascii.html
@@ -174,21 +174,19 @@ element of that type can be used as an alternative to the implementationExamples
 
+

Convert all files in the directory srcdir ending in .eucjis from the +EUCJIS encoding to ASCII and rename them to end in .java.

 <native2ascii encoding="EUCJIS" src="srcdir" dest="srcdir"
               includes="**/*.eucjis" ext=".java"/>
-

Converts all files in the directory srcdir ending in .eucjis from the -EUCJIS encoding to ASCII and renames them to end in .java.

- +

Convert all the files ending in .java in the directory native/japanese +to ASCII, placing the results in the directory src. The names of the files remain the +same.

 <native2ascii encoding="EUCJIS" src="native/japanese" dest="src"
               includes="**/*.java"/>
-

Converts all the files ending in .java in the directory native/japanese -to ASCII, placing the results in the directory src. The names of the files remain the -same.

-

If you want to use a custom Native2AsciiAdapter org.example.MyAdapter you can either use the implementation attribute:

diff --git a/manual/Tasks/nice.html b/manual/Tasks/nice.html index f371b0835..f2cce78f8 100644 --- a/manual/Tasks/nice.html +++ b/manual/Tasks/nice.html @@ -47,15 +47,19 @@ No +

Examples

-
<nice newpriority="10"/>
+

Set the Thread priority to 10 (highest).

-
<nice currentpriority="priority"/>
+
<nice newpriority="10"/>
+

Store the current Thread priority in the user property priority.

-
<nice currentpriority="currentpriority" newpriority="1"/>
+
<nice currentpriority="priority"/>
+

Set the current Thread priority to 1 (lowest), storing the original priority in the user -property currentpriority. This can be used to set the priority back to its original +property currentpriority. This can be used to set the priority back to its original value later.

+
<nice currentpriority="currentpriority" newpriority="1"/>
diff --git a/manual/Tasks/pack.html b/manual/Tasks/pack.html index 58a22fb0d..94ba5338f 100644 --- a/manual/Tasks/pack.html +++ b/manual/Tasks/pack.html @@ -64,12 +64,13 @@ See Library Dependencies for m
<gzip src="test.tar" destfile="test.tar.gz"/>
<bzip2 src="test.tar" destfile="test.tar.bz2"/>
<xz src="test.tar" destfile="test.tar.xz"/>
+ +

Download http://example.org/archive.tar and compress it +to archive.tar.gz in the project's basedir on the fly.

 <gzip destfile="archive.tar.gz">
   <url url="http://example.org/archive.tar"/>
 </gzip>
-

downloads http://example.org/archive.tar and compresses it -to archive.tar.gz in the project's basedir on the fly.

diff --git a/manual/Tasks/parallel.html b/manual/Tasks/parallel.html index 77c0c5692..999fddc26 100644 --- a/manual/Tasks/parallel.html +++ b/manual/Tasks/parallel.html @@ -136,6 +136,16 @@ reported.

from Ant. By using <daemons> such servers do not halt the build.

Examples

+

This is a typical pattern for testing a server application. In one thread the server is started +(the <wlrun> task). The other thread consists of a three tasks which are +performed in sequence. The <sleep> task is used to give the server time to come +up. Another task which is capable of validating that the server is available could be used in place +of the <sleep> task. The <junit> test harness then runs, again +in its own JVM. Once the tests are complete, the server is stopped +(using <wlstop> in this example), allowing both threads to +complete. The <parallel> task will also complete at this time and the build will +then continue.

+
 <parallel>
   <wlrun ... >
@@ -145,15 +155,14 @@ from Ant. By using <daemons> such servers do not halt the bui
     <wlstop/>
   </sequential>
 </parallel>
-

This example represents a typical pattern for testing a server application. In one thread the -server is started (the <wlrun> task). The other thread consists of a three tasks -which are performed in sequence. The <sleep> task is used to give the server time -to come up. Another task which is capable of validating that the server is available could be used -in place of the <sleep> task. The <junit> test harness then -runs, again in its own JVM. Once the tests are complete, the server is stopped -(using <wlstop> in this example), allowing both threads to complete. The -<parallel> task will also complete at this time and the build will then -continue.

+ +

Here, two independent tasks run to achieve better resource utilization during the build. In this +instance, some servlets are being compiled in one thread and a set of JSPs is being precompiled in +another. Developers need to be careful that the two tasks are independent, both in terms of their +dependencies and in terms of their potential interactions in Ant's external environment. Here we +set fork=true for the <javac> task, so that it runs in a new +process; if the <wljspc> task used the javac compiler in-VM (it may), +concurrency problems may arise.

 <parallel>
@@ -161,13 +170,12 @@ continue.

<wljspc ...> <!-- precompile JSPs --> </parallel>
-

This example shows two independent tasks being run to achieve better resource utilization during -the build. In this instance, some servlets are being compiled in one thread and a set of JSPs is -being precompiled in another. Developers need to be careful that the two tasks are independent, both -in terms of their dependencies and in terms of their potential interactions in Ant's external -environment. Here we set fork=true for the <javac> task, so -that it runs in a new process; if the <wljspc> task used the javac -compiler in-VM (it may), concurrency problems may arise.

+

This example represents a typical need for use of the threadCount +and threadsPerProcessor attributes. Spinning up all 40 of those tasks could cripple the +system for memory and CPU time. By limiting the number of concurrent executions you can reduce +contention for CPU, memory and disk IO, and so actually finish faster. This is also a good candidate +for use of threadCount (and possibly threadsPerProcessor) because each task is +independent (every new JVM is forked) and has no dependencies on the other tasks.

  <macrodef name="dbpurge">
@@ -191,12 +199,5 @@ compiler in-VM (it may), concurrency problems may arise.

<!-- repeated about 40 times --> </parallel>
-

This example represents a typical need for use of the threadCount -and threadsPerProcessor attributes. Spinning up all 40 of those tasks could cripple the -system for memory and CPU time. By limiting the number of concurrent executions you can reduce -contention for CPU, memory and disk IO, and so actually finish faster. This is also a good -candidate for use of threadCount (and possibly threadsPerProcessor) because -each task is independent (every new JVM is forked) and has no dependencies on the other tasks.

- diff --git a/manual/Tasks/patch.html b/manual/Tasks/patch.html index 6f651f2fa..c3a0eeae0 100644 --- a/manual/Tasks/patch.html +++ b/manual/Tasks/patch.html @@ -88,16 +88,18 @@

Examples

-
<patch patchfile="module.1.0-1.1.patch"/>
-

applies the diff included in module.1.0-1.1.patch to the files in base directory + +

Apply the diff included in module.1.0-1.1.patch to the files in base directory guessing the filename(s) from the diff output.

+
<patch patchfile="module.1.0-1.1.patch"/>
+ +

Here, one leading directory part will be removed:

<patch patchfile="module.1.0-1.1.patch" strip="1"/>
-

like above but one leading directory part will be removed. i.e. if the diff output looked -like

+

i.e. if the diff output looked like

 --- a/mod1.0/A  Mon Jun  5 17:28:41 2000
 +++ a/mod1.1/A  Mon Jun  5 17:28:49 2000
-the leading a/ will be stripped. +

the leading a/ will be stripped.

diff --git a/manual/Tasks/pathconvert.html b/manual/Tasks/pathconvert.html index 373cc25d6..f0b7a169e 100644 --- a/manual/Tasks/pathconvert.html +++ b/manual/Tasks/pathconvert.html @@ -126,6 +126,7 @@ specified to perform any of various filename transformations (since Ant 1.6. value d:\weblogic, and ${wl.home.unix} has the value /weblogic.

Example 1

+

Here, the task

 <path id="wl.path">
   <pathelement location="${wl.home}/lib/weblogicaux.jar"/>
@@ -157,23 +158,24 @@ named wl.path.unix.

/usr/local/ant/lib/njavac.jar:/usr/local/ant/lib/xproperty.jar

Example 3

+

Here, the names of files determined by the fileset (all files ending in .java) are +joined separated by comma, and the resulting list is placed into the +property javafiles. The directory separator is not specified, so it defaults to the +appropriate character for the current platform. Such a list could then be used in another task, +like javadoc, that requires a comma separated list of files.

 <fileset dir="${src.dir}" id="src.files">
   <include name="**/*.java"/>
 </fileset>
 
 <pathconvert pathsep="," property="javafiles" refid="src.files"/>
-

This example takes the set of files determined by the fileset (all files ending -in .java), joins them together separated by commas, and places the resulting list into -the property javafiles. The directory separator is not specified, so it defaults to -the appropriate character for the current platform. Such a list could then be used in another task, -like javadoc, that requires a comma separated list of files.

+

Example 4

+

This task sets the property prop to def|ghi on Windows and on Unix.

 <pathconvert property="prop" dirsep="|">
   <map from="${basedir}/abc/" to=""/>
   <path location="abc/def/ghi"/>
 </pathconvert>
-

This example sets the property prop to def|ghi on Windows and on Unix.

diff --git a/manual/Tasks/property.html b/manual/Tasks/property.html index 5adef626a..0a362c4d9 100644 --- a/manual/Tasks/property.html +++ b/manual/Tasks/property.html @@ -205,57 +205,56 @@ a path-like structure and can also be set via a nested classpath element.

Examples

+

Set the property foo.dist to the value dist.

<property name="foo.dist" value="dist"/>
-

sets the property foo.dist to the value dist.

+

Set the property foo.dist to the value dist.

<property name="foo.dist">dist</property>
-

sets the property foo.dist to the value dist.

+

Read a set of properties from a file called foo.properties.

<property file="foo.properties"/>
-

reads a set of properties from a file called foo.properties.

-
<property url="http://www.mysite.com/bla/props/foo.properties"/>
-

reads a set of properties from the +

Read a set of properties from the address http://www.mysite.com/bla/props/foo.properties.

+
<property url="http://www.mysite.com/bla/props/foo.properties"/>
+

Read a set of properties from a resource called foo.properties.

<property resource="foo.properties"/>
-

reads a set of properties from a resource called foo.properties.

+

Note that you can reference a global properties file for all of your Ant builds using the following:

-
<property file="${user.home}/.ant-global.properties"/>
-

since the user.home property is defined by JVM to be your home directory. Where +

since the user.home property is defined by JVM to be your home directory. Where the user.home property resolves to in the file system depends on the operating system version and the JVM implementation. On Unix based systems, this will map to the user's home directory. On modern Windows variants, this will most likely resolve to the user's directory in the Documents and Settings or Users folder. Older Windows variants such as Windows 98/ME are less predictable, as are other operating system/JVM combinations.

+

Read the system environment variables and stores them in properties, prefixed +with env. Note that this only works on select operating systems. Two of the values +are shown being echoed.

 <property environment="env"/>
 <echo message="Number of Processors = ${env.NUMBER_OF_PROCESSORS}"/>
 <echo message="ANT_HOME is set to = ${env.ANT_HOME}"/>
-

reads the system environment variables and stores them in properties, prefixed with env. -Note that this only works on select operating systems. Two of the values are shown being -echoed. -

-
-<property environment="env"/>
-<property file="${user.name}.properties"/>
-<property file="${env.STAGE}.properties"/>
-<property file="build.properties"/>

This buildfile uses the properties defined in build.properties. Regarding to the environment variable STAGE some or all values could be overwritten, e.g. having STAGE=test and a test.properties you have special values for that (like another name for the test server). Finally all these values could be overwritten by personal settings with a file per user.

+
+<property environment="env"/>
+<property file="${user.name}.properties"/>
+<property file="${env.STAGE}.properties"/>
+<property file="build.properties"/>
+

Store the relative path in foo: ../my/file.txt

<property name="foo" location="my/file.txt" relative="true" basedir=".."/>
-

Stores the relative path in foo: ../my/file.txt

+

Store the relative path in foo: cvs/my/file.txt

<property name="foo" location="my/file.txt" relative="true" basedir="cvs"/>
-

Stores the relative path in foo: cvs/my/file.txt

Property files

diff --git a/manual/Tasks/rename.html b/manual/Tasks/rename.html index f662a80a4..7c59ef773 100644 --- a/manual/Tasks/rename.html +++ b/manual/Tasks/rename.html @@ -53,11 +53,12 @@

Examples

-
<rename src="foo.jar" dest="${name}-${version}.jar"/>
-

Renames the file foo.jar to ${name}-${version}.jar + +

Rename the file foo.jar to ${name}-${version}.jar (assuming name and version being predefined properties). If a file named ${name}-${version}.jar already exists, it will be removed prior to renaming foo.jar.

+
<rename src="foo.jar" dest="${name}-${version}.jar"/>
diff --git a/manual/Tasks/replace.html b/manual/Tasks/replace.html index ec789cb2f..b30c2fad3 100644 --- a/manual/Tasks/replace.html +++ b/manual/Tasks/replace.html @@ -201,6 +201,10 @@ the <replace> attribute value and/or the <replacevalue> element is used. If no value was specified using either of these options, the token is replaced with an empty string.

Examples

+

In file configure.sh, replace all instances of @token1@ +with defaultvalue, all instances of @token2@ with value2, and all instances +of @token3@ with the value of the property property.key, as it appears in +property file src/name.properties.

 <replace file="configure.sh"
          value="defaultvalue"
@@ -215,10 +219,6 @@ these options, the token is replaced with an empty string.

<replacevalue>value4</replacevalue> </replacefilter> </replace>
-

In file configure.sh, replace all instances of @token1@ -with defaultvalue, all instances of @token2@ with value2, and all instances -of @token3@ with the value of the property property.key, as it appears in -property file src/name.properties.

Note: It is possible to use either the token/<replacetoken> and value/<replacevalue> attributes/elements, the diff --git a/manual/Tasks/replaceregexp.html b/manual/Tasks/replaceregexp.html index eefdf6bd9..e143cea74 100644 --- a/manual/Tasks/replaceregexp.html +++ b/manual/Tasks/replaceregexp.html @@ -123,6 +123,9 @@ instance.

Examples

+

Replace occurrences of the property name OldProperty with NewProperty in a +properties file, preserving the existing value, in all files ending in .properties in +the current directory:

 <replaceregexp byline="true">
     <regexp pattern="OldProperty=(.*)"/>
@@ -131,42 +134,37 @@ instance.

<include name="*.properties"/> </fileset> </replaceregexp>
-

replaces occurrences of the property name OldProperty with NewProperty in a -properties file, preserving the existing value, in all files ending in .properties in -the current directory

+

Replace all whitespaces (blanks, tabs, etc) by one blank remaining the line separator:

 <replaceregexp match="\s+" replace=" " flags="g" byline="true">
     <fileset dir="${html.dir}" includes="**/*.html"/>
 </replaceregexp>
-

replaces all whitespaces (blanks, tabs, etc) by one blank remaining the line separator. So with -input

- +

Then, input

 <html>    <body>
 <<TAB>><h1>    T E S T   </h1>  <<TAB>>
 <<TAB>> </body></html>
-

would converted to

+

is converted to

 <html> <body>
  <h1> T E S T </h1> </body></html>
-
- +

The task

 <replaceregexp match="\\n" replace="${line.separator}" flags="g" byline="true">
     <fileset dir="${dir}"/>
 </replaceregexp>
-

replaces all \n markers (beware the quoting of the backslash) by a line break. So with +

replaces all \n markers (beware the quoting of the backslash) by a line break. Then, input

one\ntwo\nthree
-

would converted to

+

is converted to

 one
 two
 three
-

Beware that inserting line breaks could break file syntax. For example in xml:

+

Beware that inserting line breaks could break file syntax. For example in XML:

 <root>
     <text>line breaks \n should work in text</text>
diff --git a/manual/Tasks/resourcecount.html b/manual/Tasks/resourcecount.html
index 3c2addac8..753f16148 100644
--- a/manual/Tasks/resourcecount.html
+++ b/manual/Tasks/resourcecount.html
@@ -74,13 +74,16 @@ a condition.

via a nested element or the refid attribute.

Examples

+

Store the number of resources in the specified filelist (two files) in the property +named count.foo.

 <resourcecount property="count.foo">
   <filelist dir="." files="foo,bar"/>
 </resourcecount>
-

Stores the number of resources in the specified filelist (two) in the property -named count.foo.

+

Store the number of lines of the current buildfile in the +property file.lines. Requires Ant 1.7.1+ as <concat> has to be a +resource.

 <project>
   <property name="file" value="${ant.file}"/>
@@ -98,8 +101,6 @@ named count.foo.

</resourcecount> <echo>The file '${file}' has ${file.lines} lines.</echo> </project>
-

Stores the number of lines of the current buildfile in the property file.lines. -Requires Ant 1.7.1+ as <concat> has to be a resource.

diff --git a/manual/Tasks/retry.html b/manual/Tasks/retry.html index 6e1b217b5..2fefee754 100644 --- a/manual/Tasks/retry.html +++ b/manual/Tasks/retry.html @@ -51,12 +51,12 @@ a BuildException is thrown.

Any valid Ant task may be embedded within the retry task.

Example

+

This example shows how to use <retry> to wrap a task which must interact with +an unreliable network resource.

 <retry retrycount="3">
   <get src="http://www.unreliable-server.com/unreliable.tar.gz"
        dest="/home/retry/unreliable.tar.gz"/>
 </retry>
-

This example shows how to use <retry> to wrap a task which must interact with -an unreliable network resource.

diff --git a/manual/Tasks/rmic.html b/manual/Tasks/rmic.html index cd3247af8..c9a9dfa3f 100644 --- a/manual/Tasks/rmic.html +++ b/manual/Tasks/rmic.html @@ -297,13 +297,15 @@ using one of the built-in compilers.

can be used as an alternative to the compiler attribute.

Examples

-
<rmic classname="com.xyz.FooBar" base="${build}/classes"/>
-

runs the rmic compiler for the class com.xyz.FooBar. The compiled files + +

Run the rmic compiler for the class com.xyz.FooBar. The compiled files will be stored in the directory ${build}/classes.

-
<rmic base="${build}/classes" includes="**/Remote*.class"/>
-

runs the rmic compiler for all classes with .class files +

<rmic classname="com.xyz.FooBar" base="${build}/classes"/>
+ +

Run the rmic compiler for all classes with .class files below ${build}/classes whose classname starts with Remote. The compiled files will be stored in the directory ${build}/classes.

+
<rmic base="${build}/classes" includes="**/Remote*.class"/>

If you want to use a custom RmicAdapter org.example.MyAdapter you can either use the compiler attribute:

diff --git a/manual/Tasks/schemavalidate.html b/manual/Tasks/schemavalidate.html index abc3c610f..6baf94e5c 100644 --- a/manual/Tasks/schemavalidate.html +++ b/manual/Tasks/schemavalidate.html @@ -216,11 +216,17 @@ properties. Properties can be used to set the schema used to validate the XM

Examples

+

Validate a document against an XML schema. The document does not declare any schema itself, which +is why the noNamespaceFile is needed.

 <schemavalidate noNamespaceFile="document.xsd"
                 file="xml/endpiece.xml"/>
-

Validate a document against an XML schema. The document does not declare any schema itself, which -is why the noNamespaceFile is needed.

+ +

Declare a new preset task, <validate-soap>, that validates XSD and WSDL +documents against the relevant specifications. To validate XSD documents, you also +need XMLSchema.dtd and datatypes.dtd in the same directory +as XMLSchema.xsd, or pointed to via the catalog. All these files can be fetched +from W3C.

 <presetdef name="validate-soap">
   <schemavalidate>
@@ -234,13 +240,9 @@ is why the noNamespaceFile is needed.

file="${soap.dir}/XMLSchema.xsd"/> </schemavalidate> </presetdef>
-

Declare a new preset task, <validate-soap>, that validates XSD and WSDL -documents against the relevant specifications. To validate XSD documents, you also -need XMLSchema.dtd and datatypes.dtd in the same directory -as XMLSchema.xsd, or pointed to via the catalog. All these files can be fetched -from W3C.

-
<validate-soap file="xml/test.xsd"/>
+

Use the preset task defined above to validate an XML Schema document.

+
<validate-soap file="xml/test.xsd"/>
diff --git a/manual/Tasks/scp.html b/manual/Tasks/scp.html index 98db95a37..3b58a45de 100644 --- a/manual/Tasks/scp.html +++ b/manual/Tasks/scp.html @@ -210,39 +210,41 @@ set.

Prior to Ant 1.9.7 only <fileset> has been supported as a nested element.

Examples

-

Copy a single local file to a remote machine

+

Copy a single local file to a remote machine:

<scp file="myfile.txt" todir="user:password@somehost:/home/chuck"/>
-

Copy a single local file to a remote machine with separate password -attribute

+

Copy a single local file to a remote machine with separate password +attribute:

<scp file="myfile.txt" todir="user@somehost:/home/chuck" password="password"/>
-

Copy a single local file to a remote machine using key base authentication.

+

Copy a single local file to a remote machine using key base authentication:

 <scp file="myfile.txt"
      todir="user@somehost:/home/chuck"
      keyfile="${user.home}/.ssh/id_dsa"
      passphrase="my extremely secret passphrase"/>
-

Copy a single remote file to a local directory

+

Copy a single remote file to a local directory:

<scp file="user:password@somehost:/home/chuck/myfile.txt" todir="../some/other/dir"/>
-

Copy a remote directory to a local directory

+

Copy a remote directory to a local directory:

<scp file="user:password@somehost:/home/chuck/*" todir="/home/sara"/>
-

Copy a local directory to a remote directory

+

Copy a local directory to a remote directory:

 <scp todir="user:password@somehost:/home/chuck/">
   <fileset dir="src_dir"/>
 </scp>
-

Copy a set of files to a directory

+ +

Copy a set of files to a directory:

 <scp todir="user:password@somehost:/home/chuck">
   <fileset dir="src_dir">
     <include name="**/*.java"/>
   </fileset>
 </scp>
-

Copy a set of files to a remote directory in reverse last-modified order

+ +

Copy a set of files to a remote directory in reverse last-modified order:

 <scp todir="user:password@somehost:/home/chuck">
   <sort>
@@ -259,6 +261,7 @@ attribute

can be a serious security hole. Consider using variable substitution and include the password on the command line. For example:

<scp todir="${username}:${password}@host:/dir" ...>
+

Invoking Ant with the following command line:

ant -Dusername=me -Dpassword=mypassword target1 target2

is slightly better, but the username/password is exposed to all users on an Unix system (via diff --git a/manual/Tasks/script.html b/manual/Tasks/script.html index cd33533d9..d6bdf46b0 100644 --- a/manual/Tasks/script.html +++ b/manual/Tasks/script.html @@ -183,10 +183,8 @@ file.

</classpath> System.out.println("Hello world"); </script>
-

- The following script uses JavaScript to create a number of - echo tasks and execute them. -

+

The following script uses JavaScript to create a number of echo tasks and execute +them.

 <project name="squares" default="main" basedir=".">
   <target name="main">
@@ -267,17 +265,17 @@ of all files a <fileset/> caught.

import. Rhino knows two different methods for import statements: one for packages and one for a single class. By default only the java packages are available, so java.lang.System can be directly imported -with importClass/importPackage. For other packages you have to prefix the full -classified name with Packages. For example Ant's FileUtils class can -be imported +with importClass/importPackage. For other packages you have to prefix the +full classified name with Packages. For example +Ant's FileUtils class can be imported with importClass(Packages.org.apache.tools.ant.util.FileUtils)
The <script> task populates the Project instance under the name project, so we can use that reference. Another way is to use its given name or -getting its reference from the task itself.
The Project provides methods for accessing and -setting properties, creating DataTypes and Tasks and much more.
After creating a FileSet -object we initialize that by calling its set-methods. Then we can use that object like a normal Ant -task (<copy> for example).
For getting the size of a file we instantiate -a java.io.File. So we are using normal Java API here.
Finally we use +getting its reference from the task itself.
The Project provides methods for accessing and +setting properties, creating DataTypes and Tasks and much more.
After creating a FileSet object +we initialize that by calling its set-methods. Then we can use that object like a normal Ant task +(<copy> for example).
For getting the size of a file we instantiate +a java.io.File. So we are using normal Java API here.
Finally we use the <echo> task for producing the output. The task is not executed by its execute() method, because the perform() method (implemented in Task itself) does the appropriate logging before and after diff --git a/manual/Tasks/scriptdef.html b/manual/Tasks/scriptdef.html index 2540a59c9..23dd22826 100644 --- a/manual/Tasks/scriptdef.html +++ b/manual/Tasks/scriptdef.html @@ -261,8 +261,8 @@ self.log("text: " +self.text) <s:echo>nested text</s:echo> </target>
-

The next example shows the use of <classpath> -and loaderref to get access to the beanshell jar.

+

The next example shows the use of <classpath> and loaderref to get +access to the beanshell jar.

 <scriptdef name="b1" language="beanshell"
            loaderref="beanshell-ref">
diff --git a/manual/Tasks/sequential.html b/manual/Tasks/sequential.html
index 3d7fc10b2..ec7577760 100644
--- a/manual/Tasks/sequential.html
+++ b/manual/Tasks/sequential.html
@@ -34,6 +34,9 @@ execution of a subset of tasks within the parallel t
 from Ant tasks. Any valid Ant task may be embedded within the sequential task.

Example

+ +

This example shows how the sequential task is used to execute three tasks in +sequence, while another task is being executed in a separate thread.

 <parallel>
   <wlrun ... >
@@ -43,8 +46,6 @@ from Ant tasks. Any valid Ant task may be embedded within the sequential task.
-

This example shows how the sequential task is used to execute three tasks in -sequence, while another task is being executed in a separate thread.

diff --git a/manual/Tasks/setpermissions.html b/manual/Tasks/setpermissions.html index 74c099eff..335d77c2c 100644 --- a/manual/Tasks/setpermissions.html +++ b/manual/Tasks/setpermissions.html @@ -79,18 +79,21 @@ different sets of permissions to apply to either type of resource.

any resource collection

resource collections are used to select groups of resources.

+

Examples

+ +

Make the start.sh file readable and executable for anyone and in addition writable +by the owner.

 <setpermissions mode="755">
   <file file="${dist}/start.sh"/>
 </setpermissions>
-

makes the start.sh file readable and executable for anyone and in addition writable + +

Make the start.sh file readable and executable for anyone and in addition writable by the owner.

 <setpermissions permissions="OWNER_READ,OWNER_WRITE,OWNER_EXECUTE,OTHERS_READ,OTHERS_EXECUTE,GROUP_READ,GROUP_EXECUTE">
   <file file="${dist}/start.sh"/>
 </setpermissions>
-

makes the start.sh file readable and executable for anyone and in addition writable -by the owner.

diff --git a/manual/Tasks/setproxy.html b/manual/Tasks/setproxy.html index 91bcecdbb..c85887c07 100644 --- a/manual/Tasks/setproxy.html +++ b/manual/Tasks/setproxy.html @@ -85,14 +85,27 @@ FTP proxy, or a SOCKS server, reset the server settings, or do nothing at all.

Examples

-
<setproxy/>
do nothing -
<setproxy proxyhost="firewall"/>
set the proxy to firewall:80 -
<setproxy proxyhost="firewall" proxyport="81"/>
set the proxy to firewall:81 -
<setproxy proxyhost=""/>
stop using HTTP proxy; don't change SOCKS settings -
<setproxy socksproxyhost="socksy"/>
use SOCKS via socksy:1080 -
<setproxy socksproxyhost=""/>
stop using the SOCKS server. -

You can set a username and password for http with the proxyHost -and proxyPassword attributes. On Java 1.4 and above these can also be used against SOCKS + +

Do nothing

+
<setproxy/>
+ +

Set the proxy to firewall:80

+
<setproxy proxyhost="firewall"/>
+ +

Set the proxy to firewall:81

+
<setproxy proxyhost="firewall" proxyport="81"/>
+ +

Stop using HTTP proxy; don't change SOCKS settings

+
<setproxy proxyhost=""/>
+ +

Use SOCKS via socksy:1080

+
<setproxy socksproxyhost="socksy"/>
+ +

Stop using the SOCKS server

+
<setproxy socksproxyhost=""/>
+ +

You can set a username and password for HTTP with the proxyHost +and proxyPassword attributes. On Java 1.4 and above, these can also be used against SOCKS 5 servers.

diff --git a/manual/Tasks/signjar.html b/manual/Tasks/signjar.html index 39e1dfd69..75c2a3bd2 100644 --- a/manual/Tasks/signjar.html +++ b/manual/Tasks/signjar.html @@ -213,11 +213,16 @@ place.

For instructions on generating a code signing certificate, see the keytool documentation and/or instructions from your certificate authority.

+ +

Sign the ant.jar with alias apache-group accessing the keystore and private +key via secret password.

 <signjar jar="${dist}/lib/ant.jar"
          alias="apache-group" storepass="secret"/>
-

signs the ant.jar with alias apache-group accessing the keystore and private -key via secret password.

+ +

Sign all JAR files matching the dist/**/*.jar pattern, copying them to the +directory signed afterwards. The flatten mapper means that they will all be copied to +this directory, not to subdirectories.

 <signjar destDir="signed"
          alias="testonly" keystore="testkeystore"
@@ -228,9 +233,9 @@ key via secret password.

</path> <flattenmapper/> </signjar>
-

Sign all JAR files matching the dist/**/*.jar pattern, copying them to the -directory signed afterwards. The flatten mapper means that they will all be copied to -this directory, not to subdirectories.

+ +

Sign all the JAR files in dist/**/*.jar in-situ. Lazy signing is used, so +the files will only be signed if they are not already signed.

 <signjar alias="testonly" keystore="testkeystore"
          storepass="apacheant"
@@ -239,8 +244,11 @@ this directory, not to subdirectories.

<fileset dir="dist" includes="**/*.jar"/> </path> </signjar>
-

Sign all the JAR files in dist/**/*.jar in-situ. Lazy signing is used, so -the files will only be signed if they are not already signed.

+ +

Sign all the JAR files in dist/**/*.jar using the digest algorithm SHA1 and the +signature algorithm MD5withRSA. This is especially useful when you want to use the JDK +7 jarsigner (which uses SHA256 and SHA256withRSA as default) to create signed jars that +will be deployed on platforms not supporting SHA256 and SHA256withRSA.

 <signjar alias="testonly" keystore="testkeystore"
          storepass="apacheant"
@@ -250,10 +258,7 @@ the files will only be signed if they are not already signed.

<fileset dir="dist" includes="**/*.jar"/> </path> </signjar>
-

Sign all the JAR files in dist/**/*.jar using the digest algorithm SHA1 and the -signature algorithm MD5withRSA. This is especially useful when you want to use the JDK -7 jarsigner (which uses SHA256 and SHA256withRSA as default) to create signed jars that -will be deployed on platforms not supporting SHA256 and SHA256withRSA.

+

About timestamp signing

Timestamps record the date and time that a signature took place, allowing the signature to be diff --git a/manual/Tasks/sleep.html b/manual/Tasks/sleep.html index 88256d85d..c9f2bd3a5 100644 --- a/manual/Tasks/sleep.html +++ b/manual/Tasks/sleep.html @@ -67,14 +67,17 @@ negative value can be supplied to any of them provided the total sleep time is p may either be ignored or rounded up to a minimum timeslice. Note also that the system clocks often have a fairly low granularity too, which complicates measuring how long a sleep actually took.

Examples

-
<sleep milliseconds="10"/>

Sleep for about 10 ms.

-
<sleep seconds="2"/>
+
<sleep milliseconds="10"/>
+

Sleep for about 2 seconds.

-
<sleep hours="1" minutes="-59" seconds="-58"/>
+
<sleep seconds="2"/>
+

Sleep for one hour less 59:58, or two seconds again.

-
<sleep/>
+
<sleep hours="1" minutes="-59" seconds="-58"/>
+

Sleep for no time at all. This may yield the CPU time to another thread or process.

+
<sleep/>
diff --git a/manual/Tasks/sos.html b/manual/Tasks/sos.html index 1180e979e..bcb393f9d 100644 --- a/manual/Tasks/sos.html +++ b/manual/Tasks/sos.html @@ -174,6 +174,11 @@ Linux, Solaris & Windows 2000.

Example

+

Connect to a SourceOffsite server on 192.168.10.6:8888 +with build, build as the username & password. The SourceSafe database resides on +the same box as the SOS server & the VSS database is at d:\vss\srcsafe.ini. Do a +recursive GetProject on $/SourceRoot/project1, using tmp as the +working directory.

 <sosget verbose="true"
         recursive="true"
@@ -183,11 +188,6 @@ Linux, Solaris & Windows 2000.

projectpath="$/SourceRoot/project1" sosserverpath="192.168.10.6:8888" vssserverpath="d:\vss\srcsafe.ini"/>
-

Connects to a SourceOffsite server on 192.168.10.6:8888 -with build, build as the username & password. The SourceSafe database resides on -the same box as the SOS server & the VSS database is at d:\vss\srcsafe.ini. Does a -recursive GetProject on $/SourceRoot/project1, using tmp as the -working directory.


SOSLabel

@@ -254,6 +254,11 @@ working directory.

Example

+ +

Connect to a SourceOffsite server on 192.168.10.6:8888 +with build, build as the username & password. The SourceSafe database resides on +the same box as the SOS server & the VSS database is at d:\vss\srcsafe.ini. Label +the $/SourceRoot/project1 project with test label.

 <soslabel username="build"
           password="build"
@@ -261,10 +266,6 @@ working directory.

projectpath="$/SourceRoot/project1" sosserverpath="192.168.10.6:8888" vssserverpath="d:\vss\srcsafe.ini"/>
-

Connects to a SourceOffsite server on 192.168.10.6:8888 -with build, build as the username & password. The SourceSafe database resides on -the same box as the SOS server & the VSS database is at d:\vss\srcsafe.ini. Labels -the $/SourceRoot/project1 project with test label.


SOSCheckIn

@@ -356,6 +357,12 @@ the $/SourceRoot/project1 project with test label.

Example

+ +

Connect to a SourceOffsite server on server1:8888 with build, build as +the username & password. The SourceSafe database resides on a different box +(server2) & the VSS database is on a share called vss. Check-in only +the foobar.txt file adding a comment of comment abc. Extra status messages will +be displayed on screen.

 <soscheckin username="build"
             password="build"
@@ -366,12 +373,6 @@ the $/SourceRoot/project1 project with test label.

sosserverpath="server1:8888" vssserverpath="\\server2\vss\srcsafe.ini"/>
-

Connects to a SourceOffsite server on server1:8888 with build, build -as the username & password. The SourceSafe database resides on a different box -(server2) & the VSS database is on a share called vss. Checks-in only -the foobar.txt file adding a comment of comment abc. Extra status messages will -be displayed on screen.

-

SOSCheckOut

@@ -458,6 +459,13 @@ be displayed on screen.

Example

+ +

Connect to a SourceOffsite server on server1:8888 with build, build as +the username & password. The SourceSafe database resides on a different box +(server2) & the VSS database is on a share +called vss. Check-out project1, only the project1 directory will be +locked as the recursive option was not set. Extra status messages will be displayed on +screen. The soscmd(.exe) file to be used resides in /usr/local/bin.

 <soscheckout soscmd="/usr/local/bin"
              verbose="true"
@@ -466,12 +474,6 @@ be displayed on screen.

projectpath="$/SourceRoot/project1" sosserverpath="192.168.10.6:8888" vssserverpath="\\server2\vss\srcsafe.ini"/>
-

Connects to a SourceOffsite server on server1:8888 with build, build -as the username & password. The SourceSafe database resides on a different box -(server2) & the VSS database is on a share -called vss. Checks-out project1, only the project1 directory will -be locked as the recursive option was not set. Extra status messages will be displayed on -screen. The soscmd(.exe) file to be used resides in /usr/local/bin.

diff --git a/manual/Tasks/sound.html b/manual/Tasks/sound.html index d46ffd0d1..bc0d19763 100644 --- a/manual/Tasks/sound.html +++ b/manual/Tasks/sound.html @@ -74,6 +74,10 @@ and <fail> elements:

Examples

+

Play the bell.wav sound file if the build succeeded, or the ohno.wav +sound file if the build failed, three times, if the fun property is set to true. +If the target is a dependency of an "initialization" target that other targets depend on, +the fun.done property prevents the target from being executed more than once.

 <target name="fun" if="fun" unless="fun.done">
   <sound>
@@ -82,10 +86,8 @@ and <fail> elements:

</sound> <property name="fun.done" value="true"/> </target>
-

plays the bell.wav sound file if the build succeeded, or the ohno.wav -sound file if the build failed, three times, if the fun property is set to true. -If the target is a dependency of an "initialization" target that other targets depend on, -the fun.done property prevents the target from being executed more than once.

+ +

Randomly select a sound file to play when the build succeeds or fails.

 <target name="fun" if="fun" unless="fun.done">
   <sound>
@@ -95,7 +97,6 @@ the fun.done property prevents the target from being executed more
   <property name="fun.done" value="true"/>
 </target>
 
-

randomly selects a sound file to play when the build succeeds or fails.

diff --git a/manual/Tasks/splash.html b/manual/Tasks/splash.html index 1eeaf807d..5f2d2477c 100644 --- a/manual/Tasks/splash.html +++ b/manual/Tasks/splash.html @@ -99,16 +99,17 @@ that makes it clear to readers of the build exactly what is going on.

No +

Examples

-
<splash/>
+

Splash images/ant_logo_large.gif from the classpath.

+
<splash/>
+ +

Splash the Jakarta logo, for an initial period of 5 seconds.

 <splash imageurl="http://jakarta.apache.org/images/jakarta-logo.gif"
         useproxy="true"
-        showduration="5000"/>
-
-
-

Splashes the jakarta logo, for an initial period of 5 seconds.

+ showduration="5000"/>

Splash with controlled progress and nondefault text

@@ -126,8 +127,7 @@ that makes it clear to readers of the build exactly what is going on.

<sleep seconds="1"/> <echo>Progress: 100%</echo> <sleep seconds="3"/> -</target> -
+</target>
diff --git a/manual/Tasks/sql.html b/manual/Tasks/sql.html index 4923b476f..77472eab7 100644 --- a/manual/Tasks/sql.html +++ b/manual/Tasks/sql.html @@ -307,6 +307,11 @@ that need to be set when connecting to the database.

Examples

+ +

Connect to the database given in url as the sa user using +the org.database.jdbcDriver and execute the SQL statements contained within the +file data.sql

+
 <sql driver="org.database.jdbcDriver"
      url="jdbc:database-url"
@@ -314,9 +319,10 @@ that need to be set when connecting to the database.

password="pass" src="data.sql"/>
-

Connects to the database given in url as the sa user using -the org.database.jdbcDriver and executes the SQL statements contained within the -file data.sql

+

Connect to the database given in url as the sa user using +the org.database.jdbcDriver and execute the SQL statements contained within the +file data.sql. Also set the property internal_logon to the +value SYSDBA.

 <sql driver="org.database.jdbcDriver"
@@ -327,10 +333,10 @@ file data.sql

<connectionProperty name="internal_logon" value="SYSDBA"> </sql>
-

Connects to the database given in url as the sa user using -the org.database.jdbcDriver and executes the SQL statements contained within the -file data.sql. Also sets the property internal_logon to the -value SYSDBA.

+

Connect to the database given in url as the sa user using +the org.database.jdbcDriver and execute the two SQL statements inserting data +into some_table and truncating some_other_table. Ant properties in the +nested text will not be expanded.

 <sql driver="org.database.jdbcDriver"
@@ -344,11 +350,6 @@ values(1,2,3,4);
 truncate table some_other_table;
 </sql>
-

Connects to the database given in url as the sa user using -the org.database.jdbcDriver and executes the two SQL statements inserting data -into some_table and truncating some_other_table. Ant Properties in the -nested text will not be expanded.

-

Note that you may want to enclose your statements in <![CDATA[ ... ]]> sections so you don't need to escape <, >, & or other special characters. For diff --git a/manual/Tasks/sshexec.html b/manual/Tasks/sshexec.html index 2b291a052..dfa3fd76c 100644 --- a/manual/Tasks/sshexec.html +++ b/manual/Tasks/sshexec.html @@ -223,14 +223,17 @@ JSCh earlier than 0.1.28.

Examples

-

Run a command on a remote machine using password authentication

+ +

Run a command on a remote machine using password authentication

+
 <sshexec host="somehost"
          username="dude"
          password="yo"
          command="touch somefile"/>
-

Run a command on a remote machine using key authentication

+

Run a command on a remote machine using key authentication

+
 <sshexec host="somehost"
          username="dude"
@@ -238,14 +241,17 @@ JSCh earlier than 0.1.28.

passphrase="yo its a secret" command="touch somefile"/>
-

Run a command on a remote machine using key authentication with no passphrase

+

Run a command on a remote machine using key authentication with no passphrase

+
 <sshexec host="somehost"
          username="dude"
          keyfile="${user.home}/.ssh/id_dsa"
          command="touch somefile"/>
-

Run a set of commands from a command resource (file) on a remote machine using key authentication with no passphrase

+

Run a set of commands from a command resource (file) on a remote machine using key authentication +with no passphrase

+
 <sshexec host="somehost"
          username="dude"
@@ -255,11 +261,13 @@ JSCh earlier than 0.1.28.

Security Note: Hardcoding passwords and/or usernames in sshexec task can be a serious security hole. Consider using variable substitution and include the password on the command line. For example:

+
 <sshexec host="somehost"
          username="${username}"
          password="${password}"
          command="touch somefile"/>
+

Invoking Ant with the following command line:

ant -Dusername=me -Dpassword=mypassword target1 target2

is slightly better, but the username/password is exposed to all users on an Unix system (via diff --git a/manual/Tasks/sshsession.html b/manual/Tasks/sshsession.html index d94f80f34..12492ef96 100644 --- a/manual/Tasks/sshsession.html +++ b/manual/Tasks/sshsession.html @@ -185,8 +185,10 @@ which are to be executed once the SSH connection is established and all local an established.

Examples

-

Connect to a remote machine using password authentication, forward the local CVS port to -the remote host, and execute a CVS command locally, which can use the tunnel.

+ +

Connect to a remote machine using password authentication, forward the local CVS port to the +remote host, and execute a CVS command locally, which can use the tunnel.

+
 <sshsession host="somehost"
             username="dude"
@@ -200,7 +202,8 @@ the remote host, and execute a CVS command locally, which can use the tunnel.
 
-

Do the same thing using nested localtunnel element.

+

Do the same thing using nested localtunnel element.

+
 <sshsession host="somehost"
             username="dude"
@@ -214,9 +217,9 @@ the remote host, and execute a CVS command locally, which can use the tunnel.
 
-

Connect to a remote machine using key authentication, forward port 1080 to port 80 of an -intranet server which is not directly accessible, then run a get task using that -tunnel.

+

Connect to a remote machine using key authentication, forward port 1080 to port 80 of an intranet +server which is not directly accessible, then run a get task using that tunnel.

+
 <sshsession host="somehost"
             username="dude"
@@ -231,6 +234,7 @@ tunnel.

Security Note: Hardcoding passwords or passphrases and/or usernames in sshsession task can be a serious security hole. Consider using variable substitution and include the password on the command line. For example:

+
 <sshsession host="somehost"
             username="${username}"
diff --git a/manual/Tasks/subant.html b/manual/Tasks/subant.html
index 2f15d2aa3..c8e4b432b 100644
--- a/manual/Tasks/subant.html
+++ b/manual/Tasks/subant.html
@@ -156,7 +156,13 @@ whose dependencies are the targets so specified, in the order specified.

Yes +

Examples

+ +

This snippet build file will run ant in each subdirectory of the project directory, +where a file called build.xml can be found. The property build.dir will +have the value subant1.build in the Ant projects called by subant.

+
 <project name="subant" default="subant1">
     <property name="build.dir" value="subant.build"/>
@@ -168,9 +174,11 @@ whose dependencies are the targets so specified, in the order specified.

</subant> </target> </project>
-

this snippet build file will run ant in each subdirectory of the project directory, -where a file called build.xml can be found. The property build.dir will -have the value subant1.build in the Ant projects called by subant.

+ +

This snippet build file will run ant in each subdirectory of the project directory, +where a file called build.xml can be found. All properties whose name starts +with foo are passed, their names are changed to start with bar instead

+
 <subant target="">
     <propertyset>
@@ -179,19 +187,20 @@ have the value subant1.build in the Ant projects called by subant
-

this snippet build file will run ant in each subdirectory of the project directory, -where a file called build.xml can be found. All properties whose name starts -with foo are passed, their names are changed to start with bar instead

+ +

Assuming the subdirs of the project dir are +called projects1, projects2, projects3, this snippet will +execute the compile target of /opt/project/build1.xml, setting +the basedir to projects1, projects2, projects3

+
 <subant target="compile" genericantfile="/opt/project/build1.xml">
     <dirset dir="." includes="projects*"/>
 </subant>
-

assuming the subdirs of the project dir are -called projects1, projects2, projects3 this snippet will -execute the compile target of /opt/project/build1.xml, setting the basedir -to projects1, projects2, projects3

+

Now a little more complex—but useful—scenario. Assume that we have a directory structure like this:

+
 root
   |  common.xml
@@ -244,6 +253,8 @@ root
 (common.xml) and a clear project structure. Additionally the root build file is capable
 to run the whole build over all modules.

+

This task performs a clean build for each subproject.

+
 <subant failonerror="false">
     <fileset dir="." includes="**/build.xml" excludes="build.xml"/>
@@ -251,8 +262,7 @@ to run the whole build over all modules.

<target name="build"/> </subant>
-

Does a "clean build" for each subproject.

-

Hint: because build files are plain xml, you could generate the master build +

Hint: because build files are plain XML, you could generate the master build file from the common build file by using a XSLT transformation:

diff --git a/manual/Tasks/sync.html b/manual/Tasks/sync.html
index 32d5f36db..bc2c46f5b 100644
--- a/manual/Tasks/sync.html
+++ b/manual/Tasks/sync.html
@@ -121,12 +121,17 @@ to false.

Examples

+

Overwrite all files in site with newer files from generated-site, +delete files from site that are not present in generated-site.

+
 <sync todir="site">
   <fileset dir="generated-site"/>
 </sync>
-

overwrites all files in site with newer files from generated-site, -deletes files from site that are not present in generated-site.

+ +

Overwrite all files in site with newer files from generated-site, +delete files from site that are not present in generated-site but keep all +files in any CVS sub-directory.

 <sync todir="site">
@@ -135,9 +140,6 @@ deletes files from site that are not present in generated-sit
     <include name="**/CVS/**"/>
   </preserveintarget>
 </sync>
-

overwrites all files in site with newer files from generated-site, -deletes files from site that are not present in generated-site but keeps -all files in any CVS sub-directory.

diff --git a/manual/Tasks/tar.html b/manual/Tasks/tar.html index 927b96b94..643da7952 100644 --- a/manual/Tasks/tar.html +++ b/manual/Tasks/tar.html @@ -164,22 +164,28 @@ of files to archive.

element.

Examples

+ +

Tar all files in the htdocs/manual directory into a file +called manual.tar in the ${dist} directory, then apply +the gzip task to compress it.

+
 <tar destfile="${dist}/manual.tar" basedir="htdocs/manual"/>
 <gzip destfile="${dist}/manual.tar.gz" src="${dist}/manual.tar"/>
-

tars all files in the htdocs/manual directory into a file -called manual.tar in the ${dist} directory, then applies -the gzip task to compress it.

+

Tar all files in the htdocs/manual directory into a file +called manual.tar in the ${dist} directory. Files in the +directory mydocs, or files with the name todo.html are excluded.

 <tar destfile="${dist}/manual.tar"
      basedir="htdocs/manual"
      excludes="mydocs/**, **/todo.html"/>
-

tars all files in the htdocs/manual directory into a file -called manual.tar in the ${dist} directory. Files in the -directory mydocs, or files with the name todo.html are excluded.

+

Write the file docs/readme.txt as /usr/doc/ant/README into the +archive. All *.html files in the docs directory are prefixed +by /usr/doc/ant, so for example docs/index.html is written +as /usr/doc/ant/index.html to the archive.

 <tar destfile="${basedir}/docs.tar">
@@ -195,10 +201,10 @@ directory mydocs, or files with the name todo.html are
   </tarfileset>
 </tar>
-

Writes the file docs/readme.txt as /usr/doc/ant/README into the -archive. All *.html files in the docs directory are prefixed -by /usr/doc/ant, so for example docs/index.html is written -as /usr/doc/ant/index.html to the archive.

+

Build a tar which uses the GNU extensions for long paths where some files need to be marked as +executable (mode 755) and the rest use the default mode (read-write by owner). The first fileset +selects just the executable files. The second fileset must exclude the executable files and include +all others.

 <tar longfile="gnu"
@@ -214,11 +220,6 @@ as /usr/doc/ant/index.html to the archive.

</tarfileset> </tar>
-

This example shows building a tar which uses the GNU extensions for long paths and where some -files need to be marked as executable (mode 755) and the rest are use the default mode (read-write -by owner). The first fileset selects just the executable files. The second fileset must exclude the -executable files and include all others.

-

Note: The tar task does not ensure that a file is only selected by one resource collection. If the same file is selected by more than one collection, it will be included in the tar file twice, with the same path.

@@ -229,14 +230,14 @@ filesets. In the example above, ${dist.name} is not an absolute pa name of a directory, so ${dist.name} is a valid path relative to ${dist.name}/...

+

Re-package a ZIP archive as a GZip compressed tar archive. If Unix file permissions have been +stored as part of the ZIP file, they will be retained in the resulting tar archive.

+
 <tar destfile="release.tar.gz" compression="gzip">
   <zipfileset src="release.zip"/>
 </tar>
-

Re-packages a ZIP archive as a GZip compressed tar archive. If Unix file permissions have been -stored as part of the ZIP file, they will be retained in the resulting tar archive.

-

Note: Please note the tar task creates a tar file, it does not append to an existing tar file. The existing tar file is replaced instead. As with most tasks in Ant, the task only takes action if the output file (the tar file in this case) is older than the diff --git a/manual/Tasks/taskdef.html b/manual/Tasks/taskdef.html index 653b486bc..bea60126a 100644 --- a/manual/Tasks/taskdef.html +++ b/manual/Tasks/taskdef.html @@ -25,17 +25,21 @@

Taskdef

+

Description

Adds a task definition to the current project, such that this new task can be used in the current project.

This task is a form of Typedef with the attributes adapter and adaptto set to the values org.apache.tools.ant.TaskAdapter -and org.apache.tools.ant.Task respectively. Anything said in +and org.apache.tools.ant.Task respectively. Anything said in the manual page of typedef applies to taskdef as well.

+

Examples

-
<taskdef name="myjavadoc" classname="com.mydomain.JavadocTask"/>
-

makes a task called myjavadoc available to Apache Ant. The + +

Make a task called myjavadoc available to Apache Ant. The class com.mydomain.JavadocTask implements the task.

+
<taskdef name="myjavadoc" classname="com.mydomain.JavadocTask"/>
+ diff --git a/manual/Tasks/tempfile.html b/manual/Tasks/tempfile.html index 9a3da6511..e12f52c5c 100644 --- a/manual/Tasks/tempfile.html +++ b/manual/Tasks/tempfile.html @@ -74,14 +74,15 @@ temporary file, but it does guarantee that the file did not exist when the task No; defaults to false +

Examples

+

Create a temporary file

<tempfile property="temp.file"/>
-

create a temporary file

+

Create a temporary file with the .xml suffix

<tempfile property="temp.file" suffix=".xml"/>
-

create a temporary file with the .xml suffix

+

Create a temporary file in the build subdirectory

<tempfile property="temp.file" destDir="build"/>
-

create a temporary file in the build subdirectory

diff --git a/manual/Tasks/touch.html b/manual/Tasks/touch.html index 2ce9e42e7..4edf371b7 100644 --- a/manual/Tasks/touch.html +++ b/manual/Tasks/touch.html @@ -108,40 +108,40 @@ Ant 1.8, the task settings (millis and datetime) have timestamp of the original file.

Examples

-
<touch file="myfile"/>
-

creates myfile if it doesn't exist and changes the modification time to the current +

Create myfile if it doesn't exist and change the modification time to the current time.

+
<touch file="myfile"/>
-
<touch file="myfile" datetime="06/28/2000 2:02 pm"/>
-

creates myfile if it doesn't exist and changes the modification time to Jun, 28 2000 +

Create myfile if it doesn't exist and change the modification time to Jun, 28 2000 2:02 pm (14:02 for those used to 24 hour time).

+
<touch file="myfile" datetime="06/28/2000 2:02 pm"/>
+

Change the modification time to Oct, 09 1974 4:30 pm of all files and directories found +in src_dir.

 <touch datetime="09/10/1974 4:30 pm">
     <fileset dir="src_dir"/>
 </touch>
-

changes the modification time to Oct, 09 1974 4:30 pm of all files and directories found -in src_dir.

-
<touch file="myfile" datetime="06/28/2000 2:02:17 pm"/>
-

creates myfile if it doesn't exist and changes the modification time to Jun, 28 2000 +

Create myfile if it doesn't exist and change the modification time to Jun, 28 2000 2:02:17 pm (14:02:17 for those used to 24 hour time), if the filesystem allows a precision of one second—a time close to it otherwise.

+
<touch file="myfile" datetime="06/28/2000 2:02:17 pm"/>
+

Create bar if it doesn't exist and change the modification time to that +of foo.

 <touch file="foo">
     <mapper type="glob" from="foo" to="bar"/>
 </touch>
-

creates bar if it doesn't exist and changes the modification time to that -of foo.

+

Create files in the shadow directory for every .java file in +the src directory if it doesn't exist and change the modification time of those files +to the current time.

 <touch file="foo" datetime="now">
     <mapper type="regexp" from="^src(.*)\.java" to="shadow\1.empty"/>
 </touch>
-

creates files in the shadow directory for every .java file in -the src directory if it doesn't exist and changes the modification time of those files -to the current time.

diff --git a/manual/Tasks/translate.html b/manual/Tasks/translate.html index 5f1645738..7b7efe509 100644 --- a/manual/Tasks/translate.html +++ b/manual/Tasks/translate.html @@ -127,8 +127,8 @@ files.

value translated files are to be generated.

Examples

-

Translate source file encoded in English into its Japanese equivalent using a resource -bundle encoded in Japanese.

+

Translate source file encoded in English into its Japanese equivalent using a resource bundle +encoded in Japanese.

 <translate toDir="$(dest.dir}/ja"
            starttoken="#"
diff --git a/manual/Tasks/truncate.html b/manual/Tasks/truncate.html
index 3bd9c26b7..a3a300627 100644
--- a/manual/Tasks/truncate.html
+++ b/manual/Tasks/truncate.html
@@ -85,17 +85,17 @@ are expected to be filesystem-based.

Examples

+

Set the length of file foo to zero.

<truncate file="foo"/>
-

Sets the length of file foo to zero.

+

Set the length of file foo to 1 kilobyte (1024 bytes).

<truncate file="foo" length="1K"/>
-

Sets the length of file foo to 1 kilobyte (1024 bytes).

+

Adjust the length of file foo upward by 1 kilobyte.

<truncate file="foo" adjust="1K"/>
-

Adjusts the length of file foo upward by 1 kilobyte.

+

Adjust the length of file foo downward by 1 megabyte.

<truncate file="foo" adjust="-1M"/>
-

Adjusts the length of file foo downward by 1 megabyte.

diff --git a/manual/Tasks/tstamp.html b/manual/Tasks/tstamp.html index ad175d3b9..d4b8eb700 100644 --- a/manual/Tasks/tstamp.html +++ b/manual/Tasks/tstamp.html @@ -122,30 +122,30 @@ the time to generate different time values.

Examples

-
<tstamp/>
-

sets the standard DSTAMP, TSTAMP, and TODAY properties +

Set the standard DSTAMP, TSTAMP, and TODAY properties according to the default formats.

+
<tstamp/>
+

Set the standard properties as well as the property TODAY_UK with the date/time +pattern d-MMMM-yyyy using English locale (eg. 21-May-2001).

 <tstamp>
     <format property="TODAY_GB" pattern="d-MMMM-yyyy" locale="en,GB"/>
 </tstamp>
-

sets the standard properties as well as the property TODAY_UK with the date/time -pattern d-MMMM-yyyy using English locale (eg. 21-May-2001).

+

Create a timestamp, in the property touch.time, 5 hours before the current time. The +format in this example is suitable for use with the <touch> task. The standard +properties are set also.

 <tstamp>
     <format property="touch.time" pattern="MM/dd/yyyy hh:mm aa"
             offset="-5" unit="hour"/>
 </tstamp>
-

Creates a timestamp, in the property touch.time, 5 hours before the current -time. The format in this example is suitable for use with the <touch> task. The -standard properties are set also.

-
<tstamp prefix="start"/>
-

Sets three properties with the standard formats, prefixed +

Set three properties with the standard formats, prefixed with start.: start.DSTAMP, start.TSTAMP, and start.TODAY.

+
<tstamp prefix="start"/>
diff --git a/manual/Tasks/typedef.html b/manual/Tasks/typedef.html index 77ef03d0c..ff010bf82 100644 --- a/manual/Tasks/typedef.html +++ b/manual/Tasks/typedef.html @@ -158,11 +158,12 @@ structure and can also be set via a nested classpath element.The data type is now available to Ant. The class com.mydomain.URLSet implements this type.

-

Assuming a class org.acme.ant.RunnableAdapter that extends Task and +

Assuming a class org.acme.ant.RunnableAdapter that +extends Task and implements org.apache.tools.ant.TypeAdapter, and in the execute() method invokes run() on the -proxied object, one may use a Runnable class as an Ant task. The following fragment -defines a task called runclock.

+proxied object, one may use a Runnable class as an Ant task. The following +fragment defines a task called runclock.

 <typedef name="runclock"
          classname="com.acme.ant.RunClock"
@@ -183,7 +184,7 @@ load up two definitions.

classname="org.acme.filters.Filter2" loaderref="lib.path.loader"/>
-

If you want to load an antlib into a special xml-namespace, the uri attribute is +

If you want to load an antlib into a special XML namespace, the uri attribute is important:

 <project xmlns:antcontrib="antlib:net.sf.antcontrib">
diff --git a/manual/Tasks/unpack.html b/manual/Tasks/unpack.html
index 95c1c4571..d1f7692d9 100644
--- a/manual/Tasks/unpack.html
+++ b/manual/Tasks/unpack.html
@@ -62,32 +62,33 @@ See Library Dependencies for m
 

The specified resource will be used as src.

Examples

+

Expand test.tar.gz to test.tar

<gunzip src="test.tar.gz"/>
-

expands test.tar.gz to test.tar

+

Expand test.tar.bz2 to test.tar

<bunzip2 src="test.tar.bz2"/>
-

expands test.tar.bz2 to test.tar

+

Expand test.tar.xz to test.tar

<unxz src="test.tar.xz"/>
-

expands test.tar.xz to test.tar

+

Expand test.tar.gz to test2.tar

<gunzip src="test.tar.gz" dest="test2.tar"/>
-

expands test.tar.gz to test2.tar

+

Expand test.tar.gz to subdir/test.tar (assuming subdir is +a directory).

<gunzip src="test.tar.gz" dest="subdir"/>
-

expands test.tar.gz to subdir/test.tar (assuming subdir is a -directory).

+

Download http://example.org/archive.tar.gz and expand it to archive.tar +in the project's basedir on the fly.

 <gunzip dest=".">
   <url url="http://example.org/archive.tar.gz"/>
 </gunzip>
 
-

downloads http://example.org/archive.tar.gz and expands it -to archive.tar in the project's basedir on the fly.

Related tasks

+

The following

<gunzip src="some-archive.gz" dest="some-dest-dir"/>

is identical to

diff --git a/manual/Tasks/unzip.html b/manual/Tasks/unzip.html
index ab0eafe10..0d040d781 100644
--- a/manual/Tasks/unzip.html
+++ b/manual/Tasks/unzip.html
@@ -159,8 +159,31 @@ extract an Ant generated ZIP archive.

<mapper type="flatten"/> </unzip>
+

Extract all images from ant.jar which are stored in the images + directory of the jar file (or somewhere under it). While extracting the directory structure + (images) will be preserved.

+
+<unzip src="${ant.home}/lib/ant.jar" dest="...">
+  <patternset>
+    <include name="images/"/>
+  </patternset>
+</unzip>
+ +

Extract two files, ant_logo_large.gif and LICENSE.txt, + from ant.jar. More exactly: extract all files with these names from anywhere in the + source file. While extracting the directory structure will be preserved.

+
+<unzip src="${ant.home}/lib/ant.jar" dest="...">
+  <patternset>
+    <include name="**/ant_logo_large.gif"/>
+    <include name="**/LICENSE.txt"/>
+  </patternset>
+</unzip>
+

Related tasks

+

The task

+
 <unzip src="some-archive" dest="some-dir">
   <patternset>
@@ -186,36 +209,13 @@ and <tarfileset>.  <copy> offers additiona
 like filtering files on the fly, allowing a file to be
 mapped to multiple destinations or a configurable file system timestamp granularity.

+

"Delete" files from a zipfile.

+
<zip destfile="new.jar">
   <zipfileset src="old.jar">
     <exclude name="do/not/include/this/class"/>
   </zipfileset>
 </zip>
-

"Deletes" files from a zipfile.

- -
-<unzip src="${ant.home}/lib/ant.jar" dest="...">
-  <patternset>
-    <include name="images/"/>
-  </patternset>
-</unzip>
- -

This extracts all images from ant.jar which are stored in the images -directory of the Jar (or somewhere under it). While extracting the directory structure -(images) will be taken.

- -
-<unzip src="${ant.home}/lib/ant.jar" dest="...">
-  <patternset>
-    <include name="**/ant_logo_large.gif"/>
-    <include name="**/LICENSE.txt"/>
-  </patternset>
-</unzip>
- -

This extracts the two files ant_logo_large.gif and LICENSE.txt from -the ant.jar. More exactly: it extracts all files with these names from anywhere in the -source file. While extracting the directory structure will be taken.

- diff --git a/manual/Tasks/uptodate.html b/manual/Tasks/uptodate.html index 61e007ed4..a7fa55486 100644 --- a/manual/Tasks/uptodate.html +++ b/manual/Tasks/uptodate.html @@ -98,13 +98,13 @@ attribute of the nested srcfiles element.

Since Ant 1.6.3, one can use a filenamemapper type in place of the mapper element.

Examples

+

Set the property xmlBuild.notRequired to true if +the ${deploy}/xmlClasses.jar file is more up-to-date than any of the DTD files in +the ${src}/xml directory.

 <uptodate property="xmlBuild.notRequired" targetfile="${deploy}\xmlClasses.jar">
   <srcfiles dir="${src}/xml" includes="**/*.dtd"/>
 </uptodate>
-

sets the property xmlBuild.notRequired to true if -the ${deploy}/xmlClasses.jar file is more up-to-date than any of the DTD files in -the ${src}/xml directory.

This can be written as:

 <uptodate property="xmlBuild.notRequired">
diff --git a/manual/Tasks/verifyjar.html b/manual/Tasks/verifyjar.html
index e10d756ca..d025d9166 100644
--- a/manual/Tasks/verifyjar.html
+++ b/manual/Tasks/verifyjar.html
@@ -124,14 +124,15 @@ the jar attribute. Nested paths are also supported.

variables No, and only one can be supplied - +

Examples

+ +

Verify the ant.jar with alias apache-group accessing the keystore and private +key via secret password.

 <verifyjar jar="${dist}/lib/ant.jar"
            alias="apache-group" storepass="secret"/>
-

verifies the ant.jar with alias apache-group accessing the keystore and -private key via secret password.

diff --git a/manual/Tasks/vss.html b/manual/Tasks/vss.html index e7ece0b03..c081510eb 100644 --- a/manual/Tasks/vss.html +++ b/manual/Tasks/vss.html @@ -193,6 +193,11 @@ order version, date, label.

Note that only one of version, date or label should be specified

Examples

+

Perform a get on the VSS Project $/source/myproject using the username me and +the password mypassword. That will recursively get the files which are +labeled Release1 and write them to the local directory C:\mysrc\myproject. The +local files will be writable.

+
 <vssget localPath="C:\mysrc\myproject"
         recursive="true"
@@ -201,11 +206,6 @@ order version, date, label.

vsspath="$/source/aProject" writable="true"/>
-

Does a get on the VSS Project $/source/myproject using the username me and -the password mypassword. It will recursively get the files which are labeled Release1 -and write them to the local directory C:\mysrc\myproject. The local files will be -writable.

-

VssLabel

@@ -271,23 +271,23 @@ writable.

Examples

+

Label the current version of the VSS project $/source/aProject with the +label Release1 using the username me and the password mypassword.

+
 <vsslabel vsspath="$/source/aProject"
           login="me,mypassword"
           label="Release1"/>
-

Labels the current version of the VSS project $/source/aProject with the -label Release1 using the username me and the password mypassword.

+

Label version 4 of the VSS file $/source/aProject/myfile.txt with the +label 1.03.004. If this version already has a label, the operation (and the build) will +fail.

 <vsslabel vsspath="$/source/aProject/myfile.txt"
           version="4"
           label="1.03.004"/>
-

Labels version 4 of the VSS file $/source/aProject/myfile.txt with the -label 1.03.004. If this version already has a label, the operation (and the build) will -fail.

-

VssHistory

@@ -393,20 +393,22 @@ Task to perform HISTORY commands to Microsoft Visual SourceSafe.

Examples

+

Show all changes between Release1 and Release2.

+
 <vsshistory vsspath="$/myProject" recursive="true"
             fromLabel="Release1"
             toLabel="Release2"/>
-

Shows all changes between Release1 and Release2.

+

Show all changes between January 1st 2001 and March 31st 2001 (in Germany, date must be specified +according to your locale).

 <vsshistory vsspath="$/myProject" recursive="true"
             fromDate="01.01.2001"
             toDate="31.03.2001"/>
-

Shows all changes between January 1st 2001 and March 31st 2001 (in Germany, date must be -specified according to your locale).

+

Shows all changes in the last fortnight.

 <tstamp>
@@ -418,8 +420,6 @@ specified according to your locale).

dateFormat="M-d-yy;h:mma" toDate="${to.tstamp}"/>
-

Shows all changes in the 14 days before today.

-

VssCheckin

@@ -488,15 +488,15 @@ specified according to your locale).

Examples

+

Check in the file(s) named test* in the project $/test using the local +directory D:\build.

+
 <vsscheckin vsspath="$/test/test*"
             localpath="D:\build\"
             comment="Modified by automatic build"/>
 
-

Checks in the file(s) named test* in the project $/test using the local -directory D:\build.

-

VssCheckout

@@ -588,15 +588,14 @@ order version, date, label.

Examples

+

Check out the project $/test recursively to the directory D:\build.

+
 <vsscheckout vsspath="$/test"
              localpath="D:\build"
              recursive="true"
              login="me,mypass"/>
-

Does a recursive checkout of the project $/test to the -directory D:\build.

-

VssAdd

@@ -660,13 +659,13 @@ Task to perform ADD commands to Microsoft Visual SourceSafe.

Examples

+

Add the file named build.00012.zip into the project current working directory +(see vsscp).

+
 <vssadd localpath="D:\build\build.00012.zip"
         comment="Added by automatic build"/>
-

Add the file named build.00012.zip into the project current working directory -(see vsscp).

-

VssCp

@@ -711,9 +710,9 @@ Task to perform ADD commands to Microsoft Visual SourceSafe.

Examples

-
<vsscp vsspath="$/Projects/ant"/>
+

Set the current VSS project to $/Projects/ant.

-

Sets the current VSS project to $/Projects/ant.

+
<vsscp vsspath="$/Projects/ant"/>

@@ -767,9 +766,9 @@ Task to perform ADD commands to Microsoft Visual SourceSafe.

Examples

-
<vsscreate vsspath="$/existingProject/newProject"/>
+

Create the VSS Project $/existingProject/newProject.

-

Creates the VSS Project $/existingProject/newProject.

+
<vsscreate vsspath="$/existingProject/newProject"/>
diff --git a/manual/Tasks/waitfor.html b/manual/Tasks/waitfor.html index dc98f3bf8..49b010e41 100644 --- a/manual/Tasks/waitfor.html +++ b/manual/Tasks/waitfor.html @@ -95,17 +95,22 @@ for the <condition> task. See here for the full list.

Examples

+ +

Wait up to 30 seconds for a file called errors.log to appear.

 <waitfor maxwait="30" maxwaitunit="second">
     <available file="errors.log"/>
 </waitfor>
-

waits up to 30 seconds for a file called errors.log to appear.

+ +

Wait up to 3 minutes (and checks every 500 milliseconds) for a web server +on localhost to serve up the specified URL.

 <waitfor maxwait="3" maxwaitunit="minute" checkevery="500">
     <http url="http://localhost/myapp/index.html"/>
 </waitfor>
-

waits up to 3 minutes (and checks every 500 milliseconds) for a web server -on localhost to serve up the specified URL.

+ +

Wait up to 10 seconds for a server on the dbserver machine to begin listening on +port 1521 and for the http://webserver/mypage.html web page to become available.

 <waitfor maxwait="10" maxwaitunit="second">
     <and>
@@ -113,8 +118,6 @@ on localhost to serve up the specified URL.

<http url="http://webserver/mypage.html"/> </and> </waitfor>
-

waits up to 10 seconds for a server on the dbserver machine to begin listening on -port 1521 and for the http://webserver/mypage.html web page to become available.

diff --git a/manual/Tasks/war.html b/manual/Tasks/war.html index f4d9e44f3..094d68d46 100644 --- a/manual/Tasks/war.html +++ b/manual/Tasks/war.html @@ -282,7 +282,7 @@ src/html/myapp/index.html src/jsp/myapp/front.jsp src/graphics/images/gifs/small/logo.gif src/graphics/images/gifs/large/logo.gif
-then the war file myapp.war created with +

then the war file myapp.war created with

 <war destfile="myapp.war" webxml="src/metadata/myapp.xml">
   <fileset dir="src/html/myapp"/>
diff --git a/manual/Tasks/xmlvalidate.html b/manual/Tasks/xmlvalidate.html
index f1256bdc1..d3ad1eb99 100644
--- a/manual/Tasks/xmlvalidate.html
+++ b/manual/Tasks/xmlvalidate.html
@@ -164,30 +164,33 @@ properties. Properties can be used to set the schema used to validate the XM
 
 
 

Examples

-
<xmlvalidate file="toto.xml"/>

Validate toto.xml

+
<xmlvalidate file="toto.xml"/>
+ +

Validate all .xsl files in src/style, but only warn if there is an +error, rather than halt the build.

 <xmlvalidate failonerror="no" lenient="yes" warn="yes"
              classname="org.apache.xerces.parsers.SAXParser">
              classpath="lib/xerces.jar">
   <fileset dir="src" includes="style/*.xsl"/>
 </xmlvalidate>
-

Validate all .xsl files in src/style, but only warn if there is an -error, rather than halt the build.

+ +

Validate a struts configuration, using a local copy of the DTD.

 <xmlvalidate file="struts-config.xml" warn="false">
   <dtd publicId="-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
        location="struts-config_1_0.dtd"/>
 </xmlvalidate>
-

Validate a struts configuration, using a local copy of the DTD.

+

Scan all XML files in the project, using a predefined catalog to map URIs to local files.

 <xmlvalidate failonerror="no">
   <fileset dir="${project.dir}" includes="**/*.xml"/>
   <xmlcatalog refid="mycatalog"/>
 </xmlvalidate>
-

Scan all XML files in the project, using a predefined catalog to map URIs to local files.

+

Scan all XML files in the project, using the catalog defined inline.

 <xmlvalidate failonerror="no">
   <fileset dir="${project.dir}" includes="**/*.xml"/>
@@ -196,8 +199,12 @@ error, rather than halt the build.

location="com/arielpartners/knowledgebase/dtd/article.dtd"/> </xmlcatalog> </xmlvalidate>
-

Scan all XML files in the project, using the catalog defined inline.

+

Validate all .xml files in xml directory with the parser configured to +perform XSD validation. Note: The parser must support the +feature http://apache.org/xml/features/validation/schema. The schemavalidate +task is better for validating W3C XML Schemas, as it extends this task with the right options +automatically enabled, and makes it easy to add a list of schema files/URLs to act as sources.

 <xmlvalidate failonerror="yes" lenient="no" warn="yes">
   <fileset dir="xml" includes="**/*.xml"/>
@@ -205,12 +212,9 @@ error, rather than halt the build.

<attribute name="http://apache.org/xml/features/validation/schema" value="true"/> <attribute name="http://xml.org/sax/features/namespaces" value="true"/> </xmlvalidate>
-

Validate all .xml files in xml directory with the parser configured to -perform XSD validation. Note: The parser must support the -feature http://apache.org/xml/features/validation/schema. The schemavalidate -task is better for validating W3C XML Schemas, as it extends this task with the right options -automatically enabled, and makes it easy to add a list of schema files/URLs to act as sources.

+

Validate the file xml/endpiece-noSchema.xml against the +schema xml/doc.xsd.

 <!-- Convert path to URL format -->
 <pathconvert dirsep="/" property="xsd.file">
@@ -225,7 +229,5 @@ automatically enabled, and makes it easy to add a list of schema files/URLs to a
   <property name="http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
             value="${xsd.file}"/>
 </xmlvalidate>
-

Validate the file xml/endpiece-noSchema.xml against the -schema xml/doc.xsd.

diff --git a/manual/Tasks/zip.html b/manual/Tasks/zip.html index c83a28c90..87553c9bd 100644 --- a/manual/Tasks/zip.html +++ b/manual/Tasks/zip.html @@ -397,66 +397,72 @@ that zipfileset src files are added.

supports all of its attributes and nested elements.

Examples

+

Zip all files in the htdocs/manual directory into a file +called manual.zip in the ${dist} directory.

 <zip destfile="${dist}/manual.zip"
      basedir="htdocs/manual"/>
-

zips all files in the htdocs/manual directory into a file -called manual.zip in the ${dist} directory.

+ +

Zip all files in the htdocs/manual directory into a file +called manual.zip in the ${dist} directory. If manual.zip +doesn't exist, it is created; otherwise it is updated with the new/changed files.

 <zip destfile="${dist}/manual.zip"
      basedir="htdocs/manual"
      update="true"/>
-

zips all files in the htdocs/manual directory into a file -called manual.zip in the ${dist} directory. If manual.zip -doesn't exist, it is created; otherwise it is updated with the new/changed files.

+ +

Zip all files in the htdocs/manual directory. Files in the +directory mydocs, or files with the name todo.html are excluded.

 <zip destfile="${dist}/manual.zip"
      basedir="htdocs/manual"
      excludes="mydocs/**, **/todo.html"/>
-

zips all files in the htdocs/manual directory. Files in the -directory mydocs, or files with the name todo.html are excluded.

+ +

Zip all files in the htdocs/manual directory. Only html files under the +directory api are zipped, and files with the name todo.html are +excluded.

 <zip destfile="${dist}/manual.zip"
      basedir="htdocs/manual"
      includes="api/**/*.html"
      excludes="**/todo.html"/>
-

zips all files in the htdocs/manual directory. Only html files under -the directory api are zipped, and files with the name todo.html are -excluded.

+ +

Zip all files in the htdocs/manual directory, and also add the +file ChangeLog.txt in the current directory. ChangeLog.txt will be added +to the top of the ZIP file, just as if it had been located +at htdocs/manual/ChangeLog.txt.

 <zip destfile="${dist}/manual.zip">
   <fileset dir="htdocs/manual"/>
   <fileset dir="." includes="ChangeLog.txt"/>
 </zip>
-

zips all files in the htdocs/manual directory, and also adds the -file ChangeLog.txt in the current directory. ChangeLog.txt will be added -to the top of the ZIP file, just as if it had been located -at htdocs/manual/ChangeLog.txt.

+ +

Zip all files in the htdocs/manual directory into the docs/user-guide +directory in the archive, adds the file ChangeLog27.txt in the current directory +as docs/ChangeLog.txt, and includes all the html files +in examples.zip under docs/examples.

 <zip destfile="${dist}/manual.zip">
   <zipfileset dir="htdocs/manual" prefix="docs/user-guide"/>
   <zipfileset dir="." includes="ChangeLog27.txt" fullpath="docs/ChangeLog.txt"/>
   <zipfileset src="examples.zip" includes="**/*.html" prefix="docs/examples"/>
 </zip>
-

zips all files in the htdocs/manual directory into the docs/user-guide -directory in the archive, adds the file ChangeLog27.txt in the current directory -as docs/ChangeLog.txt, and includes all the html files -in examples.zip under docs/examples. The archive might end up containing -the files:

+

The archive might end up containing the files:

     docs/user-guide/html/index.html
     docs/ChangeLog.txt
     docs/examples/index.html
-

The code

+ +

Zip all files in the htdocs/manual directory into the docs/user-guide +directory in the archive and include all the files in any file that +matches examples*.zip, such as all files within examples1.zip +or examples_for_brian.zip.

 <zip destfile="${dist}/manual.zip">
   <zipfileset dir="htdocs/manual" prefix="docs/user-guide"/>
   <zipgroupfileset dir="." includes="examples*.zip"/>
 </zip>
-

zips all files in the htdocs/manual directory into the docs/user-guide -directory in the archive and includes all the files in any file that -matches examples*.zip, such as all files within examples1.zip -or examples_for_brian.zip. The same can be achieved with

+

The same can be achieved with

 <zip destfile="${dist}/manual.zip">
   <mappedresources>
@@ -470,15 +476,12 @@ or examples_for_brian.zip.  The same can be achieved with

</archives> </zip>
-

The next example

- +

Re-package a TAR archive as a ZIP archive. If Unix file permissions have been stored as part of +the TAR file, they will be retained in the resulting ZIP archive.

 <zip destfile="release.zip">
   <tarfileset src="release.tar"/>
 </zip>
-

re-packages a TAR archive as a ZIP archive. If Unix file permissions have been stored as part of -the TAR file, they will be retained in the resulting ZIP archive.

-