From 5266b79bb882f1912afa57abb1f19de6f03485e0 Mon Sep 17 00:00:00 2001 From: Gintas Grigelionis Date: Thu, 8 Feb 2018 22:52:33 +0100 Subject: [PATCH] Tidy tag soup, trim whitespace, fix styling --- manual/antexternal.html | 12 +- manual/anttaskslist.html | 1 - manual/argumentprocessor.html | 5 +- manual/base_task_classes.html | 5 +- manual/clonevm.html | 4 +- manual/cover.html | 14 +- manual/credits.html | 6 +- manual/develop.html | 67 +- manual/dirtasks.html | 27 +- manual/feedback.html | 42 +- manual/ide.html | 2 - manual/ifunless.html | 8 +- manual/inputhandler.html | 10 +- manual/install.html | 55 +- manual/installlist.html | 1 - manual/intro.html | 7 +- manual/javacprops.html | 6 +- manual/listeners.html | 298 ++++----- manual/platform.html | 98 +-- manual/projecthelper.html | 15 +- manual/properties.html | 22 +- manual/proxy.html | 42 +- manual/running.html | 89 ++- manual/stylesheets/style.css | 57 ++ manual/sysclasspath.html | 4 +- manual/targets.html | 20 +- manual/tasksoverview.html | 610 ++++++++---------- manual/toc.html | 1 - manual/tutorial-HelloWorldWithAnt.html | 92 +-- .../tutorial-tasks-filesets-properties.html | 138 ++-- manual/tutorial-writing-tasks.html | 71 +- manual/tutorials.html | 8 +- manual/using.html | 99 ++- manual/usinglist.html | 1 - 34 files changed, 861 insertions(+), 1076 deletions(-) diff --git a/manual/antexternal.html b/manual/antexternal.html index 02d2f7b58..4f9bbc31d 100644 --- a/manual/antexternal.html +++ b/manual/antexternal.html @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. --> - @@ -31,12 +30,12 @@ administrators. But what about programmers? Can the functionality provided by Ant tasks be used in java programs?

-

Yes, and its quite easy. Before getting into the details, however, +

Yes, and its quite easy. Before getting into the details, however, we should mention the pros and cons of this approach:

Pros

- +
Robust @@ -65,7 +64,7 @@ code is supported by the entire Apache Ant community.

Cons

- +
Dependency on Ant Libraries @@ -86,7 +85,6 @@ open source!
-

Example

Let's say you want to unzip a zip file programmatically from java @@ -136,7 +134,7 @@ static public void unzip(String zipFilepath, String destinationDir) { taskType = "unzip"; taskName = "unzip"; target = new Target(); - } + } } Expander expander = new Expander(); expander.setSrc(new File(zipfile)); @@ -156,5 +154,5 @@ don't. Ultimately, you have to be willing to get your feet wet and read the source code. The above example is merely designed to whet your appetite and get you started. Go for it!

- + diff --git a/manual/anttaskslist.html b/manual/anttaskslist.html index bd1204946..b5b743b3b 100644 --- a/manual/anttaskslist.html +++ b/manual/anttaskslist.html @@ -25,7 +25,6 @@ -

Table of Contents

Apache Ant Tasks

diff --git a/manual/argumentprocessor.html b/manual/argumentprocessor.html index 2cd5202f0..ce7719ed7 100644 --- a/manual/argumentprocessor.html +++ b/manual/argumentprocessor.html @@ -25,7 +25,7 @@

The Command Line Processor Plugin: ArgumentProcessor

-

What is an ArgumentProcessor?

+

What is an ArgumentProcessor?

An ArgumentProcessor is a parser of command line argument which is @@ -59,7 +59,7 @@ being parsed and quit (like -projectHelp), or just set some custom properties on the project and let it run.

-

How to register it's own ArgumentProcessor

+

How to register it's own ArgumentProcessor

First, the ArgumentProcessor must be an implementation of org.apache.tools.ant.ArgumentProcessor. @@ -73,4 +73,3 @@ be found in Ant's classpath.

- diff --git a/manual/base_task_classes.html b/manual/base_task_classes.html index 1b058ebb3..801c26e14 100644 --- a/manual/base_task_classes.html +++ b/manual/base_task_classes.html @@ -29,7 +29,7 @@

The links will not work in the online version of this document.

- +
-
@@ -86,7 +86,6 @@ Abstract Base class for pack tasks.
Unpack @@ -108,7 +107,5 @@ Abstract Base class for tasks that may have multiple actions.
- - diff --git a/manual/clonevm.html b/manual/clonevm.html index b0a534209..e29ce6cce 100644 --- a/manual/clonevm.html +++ b/manual/clonevm.html @@ -24,7 +24,7 @@ -

ant.build.clonevm

+

ant.build.clonevm

Since Apache Ant 1.7

@@ -46,7 +46,5 @@ build.sysclasspath had the value "last".

specified on the Ant command line. Use the ANT_OPTS environment variable instead.

- - diff --git a/manual/cover.html b/manual/cover.html index 7075d60a0..2ef514c46 100644 --- a/manual/cover.html +++ b/manual/cover.html @@ -22,19 +22,18 @@ Apache Ant 1.10.3 User Manual - -
+ +

Apache Ant™ 1.10.3 Manual

This is the manual for version 1.10.3 of - Apache Ant. - If your version - of Ant (as verified with ant -version) is older or newer than this - version then this is not the correct manual set. Please use the documentation + Apache Ant. + If your version + of Ant (as verified with ant -version) is older or newer than this + version then this is not the correct manual set. Please use the documentation appropriate to your current version. Also, if you are using a version older than the most recent release, we recommend an upgrade to fix bugs as well as provide new functionality.

-

 

Ant's manual and API documentation is part of the binary @@ -48,6 +47,5 @@

Apache Ant, Apache Ivy, Ant, Ivy, Apache, the Apache feather logo, and the Apache Ant project logos are trademarks of The Apache Software Foundation.

- diff --git a/manual/credits.html b/manual/credits.html index 1d9e4bf61..275447dc2 100644 --- a/manual/credits.html +++ b/manual/credits.html @@ -18,7 +18,6 @@ - Apache Ant User Manual - Credits @@ -44,9 +43,9 @@
  • Bill Kelly (bill.kelly@softwired-inc.com)
  • Martijn Kruithof
  • Arnout J. Kuiper (ajkuiper@wxs.nl)
  • -
  • Antoine Lévy-Lambert
  • +
  • Antoine Lévy-Lambert
  • Conor MacNeill
  • -
  • Jan Matèrne
  • +
  • Jan Matérne
  • Stefano Mazzocchi (stefano@apache.org)
  • Erik Meade (emeade@geekfarm.org)
  • Sam Ruby (rubys@us.ibm.com)
  • @@ -65,6 +64,5 @@

    Version: 1.10.3

    - diff --git a/manual/develop.html b/manual/develop.html index 31add6a90..65b711d31 100644 --- a/manual/develop.html +++ b/manual/develop.html @@ -25,13 +25,13 @@

    Developing with Apache Ant

    -

    Writing Your Own Task

    +

    Writing Your Own Task

    It is very easy to write your own task:

    1. Create a Java class that extends org.apache.tools.ant.Task or another class that was designed to be extended.
    2. -
    3. For each attribute, write a setter method. The setter method must be a +
    4. For each attribute, write a setter method. The setter method must be a public void method that takes a single argument. The name of the method must begin with set, followed by the attribute name, with the first character of the name in uppercase, and the rest in @@ -44,7 +44,7 @@ parallel), your class must implement the interface org.apache.tools.ant.TaskContainer. If you do so, your - task can not support any other nested elements. See + task can not support any other nested elements. See below.
    5. If the task should support character data (text nested between the @@ -61,7 +61,7 @@ takes a single argument of an Object type with a no-argument constructor. The name of the add (addConfigured) method must begin with add (addConfigured), - followed by the element name. For a more complete discussion see + followed by the element name. For a more complete discussion see below.
    6. Write a public void execute method, with no arguments, that @@ -70,7 +70,7 @@

    -

    * Actually the case of the letters after +

    * Actually the case of the letters after the first one doesn't really matter to Ant, using all lower case is a good convention, though.

    @@ -124,17 +124,17 @@ good convention, though.

    have been created for addConfiguredXXX() methods, those methods get invoked now. -
  • execute() is called at runtime. +
  • execute() is called at runtime. If target1 and target2 both depend on target3, then running 'ant target1 target2' will run all tasks in target3 twice.
  • -

    Conversions Ant will perform for attributes

    +

    Conversions Ant will perform for attributes

    Ant will always expand properties before it passes the value of an -attribute to the corresponding setter method. Since Ant 1.8, it is +attribute to the corresponding setter method. Since Ant 1.8, it is possible to extend Ant's property handling such that a non-string Object may be the result of the evaluation of a string containing a single property reference. These will be assigned directly via @@ -173,7 +173,7 @@ is more! If the argument of you setter method is

    org.apache.tools.ant.types.Resource, Ant will resolve the string as a java.io.File as above, then pass in as a org.apache.tools.ant.types.resources.FileResource. - Since Ant 1.8 + Since Ant 1.8
  • org.apache.tools.ant.types.Path, Ant will tokenize @@ -205,7 +205,7 @@ is more! If the argument of you setter method is

    toString() in the enumeration is ignored; the build file must use the declared name (see Enum.getName()). You may wish to use lowercase enum constant names, in contrast to usual Java style, to look better in build files. - As of Ant 1.7.0.
  • + Since Ant 1.7.0 @@ -216,7 +216,7 @@ setters Ant could chose from, only one of them will be called, but we don't know which, this depends on the implementation of your Java virtual machine.

    -

    Supporting nested elements

    +

    Supporting nested elements

    Let's assume your task shall support nested elements with the name inner. First of all, you need a class that represents @@ -261,7 +261,7 @@ handled.

    the methods will be called, but we don't know which, this depends on the implementation of your Java virtual machine.

    -

    Nested Types

    +

    Nested Types

    If your task needs to nest an arbitrary type that has been defined using <typedef> you have two options.
      @@ -318,13 +318,13 @@ public class Sample { interface MyInterface { void setVerbose(boolean val); - } + } public static class BuildPath extends Path { public BuildPath(Project project) { super(project); } - + public void add(MyInterface inter) {} public void setUrl(String url) {} } @@ -342,7 +342,6 @@ public class Sample { as follows:

      -    
      <typedef name="myfileselector" classname="Sample$MyFileSelector" classpath="classes" loaderref="classes"/> <typedef name="buildpath" classname="Sample$BuildPath" @@ -359,10 +358,9 @@ public class Sample { </myfileselector> </fileset> </copy> -
      -

      TaskContainer

      +

      TaskContainer

      The TaskContainer consists of a single method, addTask that basically is the same as an default.properties file in the org.apache.tools.ant.taskdefs package. Then you can use it as if it were a built-in task.

      - -
      -

      Build Events

      +

      Build Events

      Ant is capable of generating build events as it performs the tasks necessary to build a project. Listeners can be attached to Ant to receive these events. This capability could be used, for example, to connect Ant to a GUI or to integrate Ant with an IDE. @@ -488,13 +484,13 @@ for the following events

    1. Message logged
    2. -

      If the build file invokes another build file via -<ant> or -<subant> or uses +

      If the build file invokes another build file via +<ant> or +<subant> or uses <antcall>, you are creating a new Ant "project" that will send target and task level events of its -own but never sends build started/finished events. Ant 1.6.2 -introduces an extension of the BuildListener interface named + own but never sends build started/finished events. Since Ant 1.6.2, +BuildListener interface has an extension named SubBuildListener that will receive two new events for

      • SubBuild started
      • @@ -512,22 +508,18 @@ listener, of course).

        will run Ant with a listener that generates an XML representation of the build progress. This listener is included with Ant, as is the default listener, which generates the logging to standard output.

        -

        Note: A listener must not access System.out and System.err directly since output on -these streams is redirected by Ant's core to the build event system. Accessing these +

        Note: A listener must not access System.out and System.err directly since output on +these streams is redirected by Ant's core to the build event system. Accessing these streams can cause an infinite loop in Ant. Depending on the version of Ant, this will -either cause the build to terminate or the Java VM to run out of Stack space. A logger, also, may +either cause the build to terminate or the Java VM to run out of Stack space. A logger, also, may not access System.out and System.err directly. It must use the streams with which it has been configured.

        -

        Note2: All methods of a BuildListener except for the "Build +

        Note: All methods of a BuildListener except for the "Build Started" and "Build Finished" events may occur on several threads simultaneously - for example while Ant is executing a <parallel> task.

        - - - -

        Example

        Writing an adapter to your favourite log library is very easy. Just implent the BuildListener interface, instantiate your logger and delegate @@ -565,25 +557,22 @@ public class MyLogAdapter implements BuildListener { - -
        -

        Source code integration

        +

        Source code integration

        The other way to extend Ant through Java is to make changes to existing tasks, which is positively encouraged. Both changes to the existing source and new tasks can be incorporated back into the Ant codebase, which benefits all users and spreads the maintenance load around.

        Please consult the -Getting Involved pages on the Apache web site +Getting Involved pages on the Apache web site for details on how to fetch the latest source and how to submit changes for reincorporation into the source tree.

        Ant also has some -task guidelines +task guidelines which provides some advice to people developing and testing tasks. Even if you intend to keep your tasks to yourself, you should still read this as it should be informative.

        - diff --git a/manual/dirtasks.html b/manual/dirtasks.html index 5c232298b..a4c3347b1 100644 --- a/manual/dirtasks.html +++ b/manual/dirtasks.html @@ -24,7 +24,7 @@ -

        Directory-based Tasks

        +

        Directory-based Tasks

        Some tasks use directory trees for the actions they perform. For example, the javac task, which compiles a directory tree with .java files into @@ -45,7 +45,7 @@ which can be used at the same time:

      • Select files based on selection criteria defined by a collection of selector nested elements.
      -

      Patternset

      +

      Patternset

      We said that Directory-based tasks can sometimes act as an implicit <fileset>, @@ -77,7 +77,7 @@ exclude patterns are used. If no include pattern is given, all files are assumed to match the include pattern (with the possible exception of the default excludes).

      -

      Patterns

      +

      Patterns

      As described earlier, patterns are used for the inclusion and exclusion of files. These patterns look very much like the patterns used in DOS and @@ -92,7 +92,7 @@ directory are considered. So while a pattern like applied since the base directory's parent is never scanned for files.

      -

      Examples:

      +
      Examples:

      *.java  matches  .java, x.java and FooBar.java, but @@ -129,8 +129,8 @@ or \, then ** is appended. For example, mypackage/test/ is interpreted as if it were mypackage/test/**.

      -

      Example patterns:

      - +
      Example patterns:
      +
      **/CVS/* Matches all files in CVS @@ -189,7 +189,7 @@ For example, mypackage/test/ is interpreted as if it were

      When these patterns are used in inclusion and exclusion, you have a powerful way to select just the files you want.

      -

      Selectors

      +

      Selectors

      The <fileset>, whether implicit or explicit in the directory-based task, also acts as an @@ -199,7 +199,7 @@ selection criteria for the files the task should work with. See the Selector documentation for more information.

      -

      Standard Tasks/Filesets

      +

      Standard Tasks/Filesets

      Many of the standard tasks in ant take one or more filesets which follow the rules given here. This list, a subset of those, is a list of standard ant tasks that can act as an implicit fileset:

      @@ -232,7 +232,7 @@ tasks that can act as an implicit fileset:

    3. <wljspc>
    4. -

      Examples

      +

      Examples

       <copy todir="${dist}">
         <fileset dir="${src}"
      @@ -263,9 +263,9 @@ but excludes all *.gif files from the copy.

      Deleting the original set of files, the delete task can act as an implicit fileset.

      -

      Default Excludes

      +

      Default Excludes

      There are a set of definitions that are excluded by default from all -directory-based tasks. As of Ant 1.8.1 they are:

      + directory-based tasks. Since Ant 1.8.1 they are:

            **/*~
            **/#*#
      @@ -282,7 +282,7 @@ directory-based tasks. As of Ant 1.8.1 they are:

      **/.svn/** **/.DS_Store
      -

      Ant 1.8.2 adds the following default excludes:

      +

      Since Ant 1.8.2, additional default excludes are:

            **/.git
            **/.git/**
      @@ -307,8 +307,5 @@ attribute.

      default excludes by using the defaultexcludes task.

      - - - diff --git a/manual/feedback.html b/manual/feedback.html index 70027f661..3baa19beb 100644 --- a/manual/feedback.html +++ b/manual/feedback.html @@ -24,38 +24,38 @@ -

      Feedback and Troubleshooting

      -

      If things do not work, especially simple things like ant -version, - then something is wrong with your configuration. Before filing bug reports and +

      Feedback and Troubleshooting

      +

      If things do not work, especially simple things like ant -version, + then something is wrong with your configuration. Before filing bug reports and emailing all the Apache Ant mailing lists

        -
      1. Check your environment variables. Are ANT_HOME and JAVA_HOME correct? If +
      2. Check your environment variables. Are ANT_HOME and JAVA_HOME correct? If they have quotes or trailing slashes, remove them.
      3. -
      4. Unset CLASSPATH; if that is wrong things go horribly wrong. Ant does not +
      5. Unset CLASSPATH; if that is wrong things go horribly wrong. Ant does not need the CLASSPATH variable defined to anything to work.
      6. Make sure there are no versions of crimson.jar or other XML parsers in JRE/ext
      7. -
      8. Is your path correct? is Ant on it? What about JDK/bin? have you tested - this? If you are using Jikes, is it on the path? A createProcess error (especially +
      9. Is your path correct? is Ant on it? What about JDK/bin? have you tested + this? If you are using Jikes, is it on the path? A createProcess error (especially with ID=2 on windows) usually means executable not found on the path.
      10. -
      11. Which version of ant are you running? Other applications distribute a copy +
      12. Which version of ant are you running? Other applications distribute a copy -it may be being picked up by accident.
      13. -
      14. If a task is failing to run is optional.jar in ANT_HOME/lib? Are there any +
      15. If a task is failing to run is optional.jar in ANT_HOME/lib? Are there any libraries which it depends on missing?
      16. -
      17. If a task doesn't do what you expect, run ant -verbose or ant +
      18. If a task doesn't do what you expect, run ant -verbose or ant -debug to see what is happening
      -

      If you can't fix your problem, start with the Ant - User Mailing List . These are other ant users who will help you learn to - use ant. If they cannot fix it then someone may suggest filing a bug report, - which will escalate the issue. Remember of course, that support, like all open - source development tasks, is voluntary. If you haven't invested time in helping - yourself by following the steps above, it is unlikely that anyone will invest +

      If you can't fix your problem, start with the Ant + User Mailing List . These are other ant users who will help you learn to + use ant. If they cannot fix it then someone may suggest filing a bug report, + which will escalate the issue. Remember of course, that support, like all open + source development tasks, is voluntary. If you haven't invested time in helping + yourself by following the steps above, it is unlikely that anyone will invest the time in helping you.

      -

      Also, if you don't understand something, the Ant - User Mailing List is the place to ask questions. Not the developer list, - nor the individuals whose names appears in the source and documentation. If +

      Also, if you don't understand something, the Ant + User Mailing List is the place to ask questions. Not the developer list, + nor the individuals whose names appears in the source and documentation. If they answered all such emails, nobody would have any time to improve ant.

      -

      To provide feedback on this software, please subscribe to the Ant +

      To provide feedback on this software, please subscribe to the Ant User Mailing List

      If you want to contribute to Ant or stay current with the latest @@ -66,7 +66,5 @@ development, join the href="http://marc.theaimsgroup.com" target="_top">http://marc.theaimsgroup.com. Other archives will be documented online at Mailing Lists Archives

      - - diff --git a/manual/ide.html b/manual/ide.html index 7f2bc6d93..e3d6baed8 100644 --- a/manual/ide.html +++ b/manual/ide.html @@ -99,7 +99,5 @@ All the modern Java IDEs support Apache Ant almost out of the box. - - diff --git a/manual/ifunless.html b/manual/ifunless.html index abbdce1b9..8d0da2eb3 100644 --- a/manual/ifunless.html +++ b/manual/ifunless.html @@ -23,9 +23,9 @@ -

      If And Unless

      +

      If And Unless

      -

      Since Ant 1.9.1 it is possible to add if and unless attributes on all tasks and nested elements using special namespaces.

      +

      Since Ant 1.9.1, it is possible to add if and unless attributes on all tasks and nested elements using special namespaces.

      In order to use this feature you need to add the following namespace declarations

      @@ -34,12 +34,12 @@
           
      -

      The if and unless namespaces support the following 3 conditions : +

      The if and unless namespaces support the following 3 conditions:

      • true
      • true if the value of the attribute evaluates to true
      • blank
      • true if the value of the attribute is null or empty
      • set
      • true if the specified property is set -

      +
      diff --git a/manual/inputhandler.html b/manual/inputhandler.html
      index 1333157e4..67235dfb4 100644
      --- a/manual/inputhandler.html
      +++ b/manual/inputhandler.html
      @@ -49,7 +49,7 @@ every Ant process, users can specify the implementation using the
       method

      -    void handleInput(InputRequest request) 
      +    void handleInput(InputRequest request)
               throws org.apache.tools.ant.BuildException;
       
      @@ -60,7 +60,7 @@ situation.

      Ant comes with three built-in implementations of this interface:

      -

      DefaultInputHandler

      +

      DefaultInputHandler

      This is the implementation you get, when you don't use the -inputhandler command line switch at all. This @@ -92,13 +92,13 @@ define it inside the ANT_OPTS environment variable.

      Like the default implementation, this InputHandler reads from standard input. However, it consumes all available input. This behavior is -useful for sending Ant input via an OS pipe. Since Ant 1.7.

      +useful for sending Ant input via an OS pipe. Since Ant 1.7

      SecureInputHandler

      This InputHandler calls System.console().readPassword(), available since Java 1.6. On earlier platforms it falls back to the -behavior of DefaultInputHandler. Since Ant 1.7.1.

      +behavior of DefaultInputHandler. Since Ant 1.7.1

      InputRequest

      @@ -112,5 +112,5 @@ input, but subclasses may use stricter validations. should be used if the user input must be part of a predefined set of choices.

      - + diff --git a/manual/install.html b/manual/install.html index 7a382d8b0..7051546ca 100644 --- a/manual/install.html +++ b/manual/install.html @@ -223,7 +223,7 @@ target="_top">http://archive.apache.org/dist/ant/. The files are organized a Ant has been used successfully on many platforms, including Linux, commercial flavours of Unix such as Solaris and HP-UX, macOS, Windows NT descendants, OS/2 Warp, Novell Netware 6, OpenVMS. The platforms used most for development are, in no particular order, Linux, macOS, Microsoft Windows and Unix; these are therefore that platforms that tend to -work best. As of Ant 1.7, Windows 9x is no longer supported. + work best. Since Ant 1.7, Windows 9x is no longer supported.

      For the current version of Ant (1.10), you will also need a JDK installed on your system, version 8 or later required. @@ -275,36 +275,22 @@ To install Ant, choose a directory and copy the distribution files there. This d ANT_HOME.

      - - - - - - - - - - - - -
      - Windows 95, Windows 98 & Windows ME Note: -
        +

      Windows 95, Windows 98 & Windows ME Note:

      +

      Note that current releases of Ant no longer support these systems. If you are using an older version of Ant, however, the script used to launch Ant will have problems if ANT_HOME is a long filename (i.e. a filename which is not of the format known as "8.3"). This is due to limitations in the OS's handling of the "for" batch file statement. It is recommended, therefore, that Ant be installed in a short, 8.3 path, such as C:\Ant. -

        -

      +

      +

      On these systems you will also need to configure more environment space to cater for the environment variables used in the Ant launch script. To do this, you will need to add or update the following line in the config.sys file -

      -

      +

      +

      shell=c:\command.com c:\ /p /e:32768 -

      -
      +

      Setup

      @@ -330,22 +316,13 @@ JDK/JRE. Ant is an application, whilst the extension directory is intended for J security restrictions on the classes which may be loaded by an extension.

      - - - - - - - - -
      - Windows Note: -
        +

      Windows Note:

      +

      The ant.bat script makes use of three environment variables - ANT_HOME, CLASSPATH and JAVA_HOME. Ensure that ANT_HOME and JAVA_HOME variables are set, and that they do not have quotes (either ' or ") and they do not end with \ or with /. CLASSPATH should be unset or empty. -

      +

      Check Installation

      @@ -398,7 +375,7 @@ In ANT_HOME/lib. This makes the JAR files available to all A

    5. -In ${user.home}/.ant/lib (as of Ant 1.6). This allows different users to add new libraries to Ant. All JAR + In ${user.home}/.ant/lib (since Ant 1.6). This allows different users to add new libraries to Ant. All JAR files added to this directory are available to command-line Ant.

    6. @@ -418,7 +395,7 @@ applications, and causes no end of support calls. See below
    7. -In some <classpath> accepted by the task itself. For example, as of Ant 1.7.0 you can run + In some <classpath> accepted by the task itself. Since Ant 1.7.0, you can run the <junit> task without junit.jar in Ant's own classpath, so long as it is included (along with your program and tests) in the classpath passed when running the task.

      @@ -627,7 +604,7 @@ version, it is not necessary to set JAVA_HOME or ANT_HOME

      -NOTE: Since Ant 1.7.0, if the ANT_HOME environment variable is set, the JPackage +Note: Since Ant 1.7.0, if the ANT_HOME environment variable is set, the JPackage distribution will be ignored.

      @@ -716,7 +693,7 @@ on how to do this.

      -As of version 1.7.0 Ant has a hard dependency on JUnit. The fetch.xml build script will download JUnit + Since Ant 1.7.0, Ant has a hard dependency on JUnit. The fetch.xml build script will download JUnit automatically, but if you don't use this you must install it manually into lib/optional (download it from JUnit.org) if you are using a source distribution of Ant.

      @@ -797,7 +774,7 @@ automatically). You will also need to install the particular Ant optional JAR co these tasks available. Please refer to the Installing Ant / Optional Tasks section above.

      - +
      diff --git a/manual/installlist.html b/manual/installlist.html index 6bbe3dd0e..44f2ef4f5 100644 --- a/manual/installlist.html +++ b/manual/installlist.html @@ -41,4 +41,3 @@ - diff --git a/manual/intro.html b/manual/intro.html index e5673ed7b..1ffd3bf81 100644 --- a/manual/intro.html +++ b/manual/intro.html @@ -23,7 +23,7 @@ -

      Introduction

      +

      Introduction

      Apache Ant is a Java-based build tool. In theory, it is kind of like make, without make's wrinkles.

      Why?

      @@ -54,7 +54,7 @@ tasks get executed. Each task is run by an object that implements a particular Task interface.

      Granted, this removes some of the expressive power that is inherent in being able to construct a shell command such as -`find . -name foo -exec rm {}`, but it +`find . -name foo -exec rm {}`, but it gives you the ability to be cross-platform--to work anywhere and everywhere. And hey, if you really need to execute a shell command, Ant has an @@ -62,8 +62,5 @@ hey, if you really need to execute a shell command, Ant has an allows different commands to be executed based on the OS it is executing on.

      - - - diff --git a/manual/javacprops.html b/manual/javacprops.html index 6cab07c46..14430cc1f 100644 --- a/manual/javacprops.html +++ b/manual/javacprops.html @@ -33,21 +33,19 @@ change the build file, Apache Ant provides two properties that help you setting default values for these attributes. If the attributes have been set explicitly, the properties listed here will be ignored.

      -

      ant.build.javac.source

      +

      ant.build.javac.source

      Since Ant 1.7

      Provides a default value for <javac>'s and <javadoc>'s source attribute.

      -

      ant.build.javac.target

      +

      ant.build.javac.target

      Since Ant 1.7

      Provides a default value for <javac>'s target attribute.

      - - diff --git a/manual/listeners.html b/manual/listeners.html index 7387288f0..f21fe1ab7 100644 --- a/manual/listeners.html +++ b/manual/listeners.html @@ -25,12 +25,12 @@

      Listeners & Loggers

      -

      Overview

      +

      Overview

      Apache Ant has two related features to allow the build process to be monitored: listeners and loggers.

      -

      Listeners

      +

      Listeners

      A listener is alerted of the following events:

      @@ -50,7 +50,7 @@ listeners and loggers.

      argument.

      -

      Loggers

      +

      Loggers

      Loggers extend the capabilities of listeners and add the following features:

      @@ -61,228 +61,222 @@ listeners and loggers.

    8. Emacs-mode aware
    9. -

      Built-in Listeners/Loggers

      +

      Built-in Listeners/Loggers

      -
      JAR Name Needed For
      +
      - - - + + + - - + - + - - - + + - - - + - - - + + - - - + - - - + + + - - - + + + - - - + + + - - - + + + - - + - +
      ClassnameDescriptionTypeClassnameDescriptionType
      org.apache.tools.ant.DefaultLoggerThe logger used implicitly unless overridden with the + org.apache.tools.ant.DefaultLoggerThe logger used implicitly unless overridden with the -logger command-line switch.BuildLoggerBuildLogger
      + org.apache.tools.ant.NoBannerLoggerThis logger omits output of empty target output.BuildLoggerThis logger omits output of empty target output.BuildLogger
      + org.apache.tools.ant.listener.MailLoggerExtends DefaultLogger such that output is still generated + Extends DefaultLogger such that output is still generated the same, and when the build is finished an e-mail can be sent.BuildLoggerBuildLogger
      + org.apache.tools.ant.listener.AnsiColorLoggerColorifies the build output.BuildLoggerColorifies the build output.BuildLogger
      + org.apache.tools.ant.listener.Log4jListener + Passes events to Apache Log4j for highly customizable logging.
      Deprecated: Apache Log4j (1.x) is not developed any more. Last release is 1.2.17 from 26-May-2012 and contains vulnerability issues.
      BuildListenerBuildListener
      org.apache.tools.ant.XmlLoggerWrites the build information to an XML file.BuildLoggerorg.apache.tools.ant.XmlLoggerWrites the build information to an XML file.BuildLogger
      org.apache.tools.ant.TimestampedLoggerPrints the time that a build finishedBuildLoggerorg.apache.tools.ant.TimestampedLoggerPrints the time that a build finishedBuildLogger
      org.apache.tools.ant.listener.BigProjectLoggerPrints the project name every targetBuildLoggerorg.apache.tools.ant.listener.BigProjectLoggerPrints the project name every targetBuildLogger
      org.apache.tools.ant.listener.SimpleBigProjectLoggerPrints the project name for subprojects only, otherwise like NoBannerLogger Since Ant 1.8.1BuildLoggerorg.apache.tools.ant.listener.SimpleBigProjectLoggerPrints the project name for subprojects only, otherwise like NoBannerLogger Since Ant 1.8.1BuildLogger
      org.apache.tools.ant.listener.ProfileLoggerThe default logger, with start times, end times and + org.apache.tools.ant.listener.ProfileLoggerThe default logger, with start times, end times and durations added for each task and target.BuildLoggerBuildLogger
      - - -

      DefaultLogger

      +

      DefaultLogger

      Simply run Ant normally, or:

      ant -logger org.apache.tools.ant.DefaultLogger

      - - -

      NoBannerLogger

      +

      NoBannerLogger

      Removes output of empty target output.

      ant -logger org.apache.tools.ant.NoBannerLogger

      - - -

      MailLogger

      +

      MailLogger

      The MailLogger captures all output logged through DefaultLogger (standard Ant output) and will send success and failure messages to unique e-mail lists, with control for turning off success or failure messages individually.

      Properties controlling the operation of MailLogger:

      - +
      - - - + + + - - - + + + - - - + + + - - - + + - - - + + - - + - - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + - + - - + - + - - - + + + - - - + + + - - + - + - - - + + +
      PropertyDescriptionRequiredPropertyDescriptionRequired
      MailLogger.mailhost Mail server to useNo, default "localhost"MailLogger.mailhost Mail server to useNo, default "localhost"
      MailLogger.port SMTP Port for the Mail serverNo, default "25"MailLogger.port SMTP Port for the Mail serverNo, default "25"
      MailLogger.useruser name for SMTP authYes, if SMTP auth is required on your SMTP server
      +
      MailLogger.useruser name for SMTP authYes, if SMTP auth is required on your SMTP server
      the email message will be then sent using Mime and requires JavaMail
      MailLogger.passwordpassword for SMTP authYes, if SMTP auth is required on your SMTP server
      +
      MailLogger.passwordpassword for SMTP authYes, if SMTP auth is required on your SMTP server
      the email message will be then sent using Mime and requires JavaMail
      MailLogger.sslon or true if ssl is needed
      +
      MailLogger.sslon or true if ssl is needed
      This feature requires JavaMail
      + no
      MailLogger.fromMail "from" addressYes, if mail needs to be sentMailLogger.fromMail "from" addressYes, if mail needs to be sent
      MailLogger.replytoMail "replyto" address(es), comma-separatedNoMailLogger.replytoMail "replyto" address(es), comma-separatedNo
      MailLogger.failure.notify Send build failure e-mails?No, default "true"MailLogger.failure.notify Send build failure e-mails?No, default "true"
      MailLogger.success.notify Send build success e-mails?No, default "true"MailLogger.success.notify Send build success e-mails?No, default "true"
      MailLogger.failure.to Address(es) to send failure messages to, comma-separatedYes, if failure mail is to be sentMailLogger.failure.to Address(es) to send failure messages to, comma-separatedYes, if failure mail is to be sent
      MailLogger.success.to Address(es) to send success messages to, comma-separatedYes, if success mail is to be sentMailLogger.success.to Address(es) to send success messages to, comma-separatedYes, if success mail is to be sent
      MailLogger.failure.cc Address(es) to send failure messages to carbon copy (cc), comma-separatedNoMailLogger.failure.cc Address(es) to send failure messages to carbon copy (cc), comma-separatedNo
      MailLogger.success.cc Address(es) to send success messages to carbon copy (cc), comma-separatedNoMailLogger.success.cc Address(es) to send success messages to carbon copy (cc), comma-separatedNo
      MailLogger.failure.bcc Address(es) to send failure messages to blind carbon copy (bcc), comma-separatedNoMailLogger.failure.bcc Address(es) to send failure messages to blind carbon copy (bcc), comma-separatedNo
      MailLogger.success.bcc Address(es) to send success messages to blind carbon copy (bcc), comma-separatedNoMailLogger.success.bcc Address(es) to send success messages to blind carbon copy (bcc), comma-separatedNo
      MailLogger.failure.subject Subject of failed buildNo, default "Build Failure"MailLogger.failure.subject Subject of failed buildNo, default "Build Failure"
      MailLogger.success.subject Subject of successful buildNo, default "Build Success"MailLogger.success.subject Subject of successful buildNo, default "Build Success"
      MailLogger.failure.bodyFixed body of the email for a failed + MailLogger.failure.bodyFixed body of the email for a failed build. Since Ant 1.8.0No, default is to send the full log output.No, default is to send the full log output.
      MailLogger.success.bodyFixed body of the email for a successful + MailLogger.success.bodyFixed body of the email for a successful build. Since Ant 1.8.0No, default is to send the full log output.No, default is to send the full log output.
      MailLogger.mimeTypeMIME-Type of the message. Since Ant 1.8.0No, default is text/plainMailLogger.mimeTypeMIME-Type of the message. Since Ant 1.8.0No, default is text/plain
      MailLogger.charsetCharacter set of the message. Since Ant 1.8.0NoMailLogger.charsetCharacter set of the message. Since Ant 1.8.0No
      MailLogger.starttls.enableon or true if STARTTLS should be supported + MailLogger.starttls.enableon or true if STARTTLS should be supported (requires JavaMail). Since Ant 1.8.0No, default is falseNo, default is false
      MailLogger.properties.file Filename of properties file that will override other values.NoMailLogger.properties.file Filename of properties file that will override other values.No
      @@ -290,9 +284,7 @@ control for turning off success or failure messages individually.

      ant -logger org.apache.tools.ant.listener.MailLogger

    10. - - -

      AnsiColorLogger

      +

      AnsiColorLogger

      The AnsiColorLogger adds color to the standard Ant output by prefixing and suffixing ANSI color code escape sequences to @@ -307,18 +299,18 @@ in the console using applications like cat, more, etc.

      This is designed to work on terminals that support ANSI color codes. It works on XTerm, ETerm, Win9x Console (with ANSI.SYS loaded.), etc.

      -

      NOTE: +

      NOTE: It doesn't work on WinNT and successors, even when a COMMAND.COM console loaded with ANSI.SYS is used.

      If the user wishes to override the default colors with custom ones, a file containing zero or more of the custom color key-value pairs must be created. The recognized keys -and their default values are shown below:

      +and their default values are shown below:

       AnsiColorLogger.ERROR_COLOR=2;31
       AnsiColorLogger.WARNING_COLOR=2;35
       AnsiColorLogger.INFO_COLOR=2;36
       AnsiColorLogger.VERBOSE_COLOR=2;32
      -AnsiColorLogger.DEBUG_COLOR=2;34
      +AnsiColorLogger.DEBUG_COLOR=2;34

      Each key takes as value a color combination defined as Attribute;Foreground;Background. In the above example, background value has not been used.

      @@ -362,12 +354,10 @@ Background is one of the following: 47 -> White
      -

      ant -logger org.apache.tools.ant.listener.AnsiColorLogger

      +
      ant -logger org.apache.tools.ant.listener.AnsiColorLogger
      - - -

      Log4jListener

      +

      Log4jListener

      Deprecated: Apache Log4j (1) is not developed any more. Last release is 1.2.17 from 26-May-2012 and contains vulnerability issues.

      Passes build events to Log4j, using the full classname's of the generator of @@ -379,13 +369,13 @@ each build event as the category:

    11. message logged - the classname of one of the above, so if a task logs a message, its classname is the category used, and so on.
    12. -

      All start events are logged as INFO.  Finish events are either logged as +

      All start events are logged as INFO. Finish events are either logged as INFO or ERROR depending on whether the build failed during that stage. Message events are logged according to their Ant logging level, mapping directly to a corresponding Log4j level.

      -

      ant -listener org.apache.tools.ant.listener.Log4jListener

      +
      ant -listener org.apache.tools.ant.listener.Log4jListener

      To use Log4j you will need the Log4j JAR file and a 'log4j.properties' @@ -394,7 +384,7 @@ classpath. If the log4j.properties is in your project root folder you can add this with -lib option:

      -
      ant -listener org.apache.tools.ant.listener.Log4jListener -lib .
      +
      ant -listener org.apache.tools.ant.listener.Log4jListener -lib .

      If, for example, you wanted to capture the same information output to the @@ -402,7 +392,7 @@ console by the DefaultLogger and send it to a file named 'build.log', you could use the following configuration:

      -
      log4j.rootLogger=ERROR, LogFile
      +
      log4j.rootLogger=ERROR, LogFile
       log4j.logger.org.apache.tools.ant.Project=INFO
       log4j.logger.org.apache.tools.ant.Target=INFO
       log4j.logger.org.apache.tools.ant.taskdefs=INFO
      @@ -412,7 +402,7 @@ log4j.appender.LogFile=org.apache.log4j.FileAppender
       log4j.appender.LogFile.layout=org.apache.log4j.PatternLayout
       log4j.appender.LogFile.layout.ConversionPattern=[%6r] %8c{1} : %m%n
       log4j.appender.LogFile.file=build.log
      -
      +

      For more information about configuring Log4J see its @@ -432,7 +422,7 @@ to your classpath (e.g. via the -lib option). (For using the bridge Ant 1.9.10/1.10.2 or higher is required.) Translating the 1.x properties file into the 2.x xml syntax would result in

      -
      <?xml version="1.0" encoding="UTF-8"?>
      +
      <?xml version="1.0" encoding="UTF-8"?>
       <Configuration status="WARN">
         <Appenders>
           <File name="file" fileName="build.log">
      @@ -451,12 +441,10 @@ Translating the 1.x properties file into the 2.x xml syntax would result in
           <Logger name="org.apache.tools.ant.taskdefs.Echo" level="WARN"/>
         </Loggers>
       </Configuration>
      -
      +
      - - -

      XmlLogger

      +

      XmlLogger

      Writes all build information out to an XML file named log.xml, or the value of the XmlLogger.file property if present, when used as a listener. When used as a logger, it writes all output to either the @@ -472,13 +460,11 @@ If you set the property to the empty string, "", no XSLT transform is declared at all.

      -

      ant -listener org.apache.tools.ant.XmlLogger
      -ant -logger org.apache.tools.ant.XmlLogger -verbose -logfile build_log.xml

      +
      ant -listener org.apache.tools.ant.XmlLogger
      +ant -logger org.apache.tools.ant.XmlLogger -verbose -logfile build_log.xml
      - - -

      TimestampedLogger

      +

      TimestampedLogger

      Acts like the default logger, except that the final success/failure message also includes the time that the build completed. For example: @@ -489,12 +475,10 @@ is declared at all.

      To use this listener, use the command:

      -ant -logger org.apache.tools.ant.listener.TimestampedLogger +
      ant  -logger org.apache.tools.ant.listener.TimestampedLogger
      - - -

      BigProjectLogger

      +

      BigProjectLogger

      This logger is designed to make examining the logs of a big build easier, especially those run under continuous integration tools. It @@ -545,10 +529,10 @@ Exiting project "junit"

      To use this listener, use the command:

      -ant -logger org.apache.tools.ant.listener.BigProjectLogger +
      ant  -logger org.apache.tools.ant.listener.BigProjectLogger
      -

      SimpleBigProjectLogger

      +

      SimpleBigProjectLogger

      Like BigProjectLogger, project-qualified target names are printed, useful for big builds with subprojects. Otherwise it is as quiet as NoBannerLogger:

      @@ -572,18 +556,18 @@ Building jar: /sources/myapp/build/myapp.jar BUILD SUCCESSFUL Total time: 1 second
      -

      since Ant 1.8.1

      +

      since Ant 1.8.1

      To use this listener, use the command:

      -ant -logger org.apache.tools.ant.listener.SimpleBigProjectLogger +
      ant -logger org.apache.tools.ant.listener.SimpleBigProjectLogger
      -

      ProfileLogger

      +

      ProfileLogger

      This logger stores the time needed for executing a task, target and the whole build and prints these information. The output contains a timestamp when entering the build, target or task and a timestamp and the needed time when exiting.

      -

      since Ant 1.8.0

      +

      since Ant 1.8.0

      Example

      Having that buildfile
      @@ -630,9 +614,7 @@ BUILD SUCCESSFUL
       Total time: 2 seconds
       
      - - -

      Writing your own

      +

      Writing your own

      See the Build Events section for developers.

      diff --git a/manual/platform.html b/manual/platform.html index 8b38731aa..0213b236a 100644 --- a/manual/platform.html +++ b/manual/platform.html @@ -15,12 +15,12 @@ limitations under the License. --> - Platform Issues +

      Platform Issues

      @@ -34,13 +34,13 @@ for example) may not work against the shipping XSL engine.

      Unix and Linux

        -
      • You should use a GNU version of tar to untar the Apache +
      • You should use a GNU version of tar to untar the Apache Ant source tree, if you have downloaded this as a tar file. If you get -weird errors about missing files, this is the problem. +weird errors about missing files, this is the problem.
      • -
      • Ant does not preserve file permissions when a file is copied, moved or +
      • Ant does not preserve file permissions when a file is copied, moved or archived, because Java does not let it read or write the permissions. - Use <chmod> to set permissions, and when creating a + Use <chmod> to set permissions, and when creating a tar archive, use the mode attribute of <tarfileset> to set the permissions in the tar file, or <apply> the real tar program.
      • @@ -50,12 +50,10 @@ of directories to build up a list of files. Unexpected things can happen.
      • Linux on IA-64: apparently you need a larger heap than the default one (64M) to compile big projects. If you get out of heap errors, either increase the heap or use a forking javac. Better yet, -use jikes for extra compilation speed. +use jikes for extra compilation speed.
      • -
      -

      Microsoft Windows

      Windows 9x (win95, win98, win98SE and winME) are not supported in Ant1.7, @@ -64,28 +62,29 @@ Windows 9x (win95, win98, win98SE and winME) are not supported in Ant1.7,

      The Ant team has retired support for these products because they are outdated and can expose customers to security risks. We recommend that customers who are -still running Windows 98 or Windows Me upgrade to a newer, more secure +still running Windows 98 or Windows Me upgrade to a newer, more secure operating system, as soon as possible.

      Customers who upgrade to Linux report improved security, richer -functionality, and increased productivity. +functionality, and increased productivity.

      +

      Microsoft Windows 2K, XP and Server 2K03

      Windows 9x (win95, win98, win98SE and winME) has a batch file system which does not work fully with long file names, so we recommend that ant and the JDK -are installed into directories without spaces, and with 8.3 filenames. +are installed into directories without spaces, and with 8.3 filenames. The Perl and Python launcher scripts do not suffer from this limitation.

      -All versions of windows are usually case insensitive, although mounted +All versions of windows are usually case insensitive, although mounted file systems (Unix drives, Clearcase views) can be case sensitive underneath, confusing patternsets.

      -Ant can often not delete a directory which is open in an Explorer window. +Ant can often not delete a directory which is open in an Explorer window. There is nothing we can do about this short of spawning a program to kill the shell before deleting directories. Nor can files that are in use be overwritten. @@ -96,6 +95,7 @@ Nor can files that are in use be overwritten.

      Microsoft Windows Vista

      +

      There are reports of problems with Windows Vista security bringing up dialog boxes asking if the user wants to run an untrusted executable @@ -103,26 +103,28 @@ Nor can files that are in use be overwritten. program. This is beyond Ant's control, and stems from the OS trying to provide some illusion of security by being reluctant to run unsigned native executables. The latest Java versions appear to resolve this problem by having signed - binaries. + binaries.

      -

      Cygwin

      -Cygwin is not an operating system; rather it is an application suite -running under Windows and providing some UNIX like functionality. Sun has -not created any specific Java Development Kit or Java Runtime Environment for -cygwin. See this link : -http://www.inonit.com/cygwin/faq/ . -Only Windows path -names are supported by JDK and JRE tools under Windows or cygwin. Relative path -names such as "src/org/apache/tools" are supported, but Java tools do not +

      +Cygwin is not an operating system; rather it is an application suite +running under Windows and providing some UNIX like functionality. Sun has +not created any specific Java Development Kit or Java Runtime Environment for +cygwin. See this link : +http://www.inonit.com/cygwin/faq/ . +Only Windows path +names are supported by JDK and JRE tools under Windows or cygwin. Relative path +names such as "src/org/apache/tools" are supported, but Java tools do not understand /cygdrive/c to mean c:\. +

      -The utility cygpath (used industrially in the ant script to support cygwin) can +The utility cygpath (used industrially in the ant script to support cygwin) can convert cygwin path names to Windows. -You can use the <exec> task in ant to convert cygwin paths to Windows path, for -instance like that : +You can use the <exec> task in ant to convert cygwin paths to Windows path, for +instance like that: +

       <property name="some.cygwin.path" value="/cygdrive/h/somepath"/>
       <exec executable="cygpath" outputproperty="windows.pathname">
      @@ -131,48 +133,50 @@ instance like that :
       </exec>
       <echo message="${windows.pathname}"/>
       
      - +

      We get lots of support calls from Cygwin users. Either it is incredibly popular, or it is trouble. If you do use it, remember that Java is a Windows application, so Ant is running in a Windows process, not a -Cygwin one. This will save us having to mark your bug reports as invalid. +Cygwin one. This will save us having to mark your bug reports as invalid. +

      Apple MacOS X

      +

      MacOS X is the first of the Apple platforms that Ant supports completely; -it is treated like any other Unix. +it is treated like any other Unix. +

      Novell Netware

      To give the same level of sophisticated control as Ant's startup scripts on other platforms, it was decided to make the main ant startup on NetWare be via a Perl Script, "runant.pl". This is found in the bin directory (for instance - bootstrap\bin or dist\bin).

      -

      One important item of note is that you need to set up the following to run ant:

      +

      One important item of note is that you need to set up the following to run Ant:

      • CLASSPATH - put ant.jar and any other needed jars on the system classpath.
      • -
      • ANT_OPTS - On NetWare, ANT_OPTS needs to include a parameter of the form, "-envCWD=ANT_HOME", with ANT_HOME being the fully expanded location of Ant, not an environment variable. This is due to the fact that the NetWare System Console has no notion of a current working directory.
      • +
      • ANT_OPTS - On NetWare, ANT_OPTS needs to include a parameter of the form, "-envCWD=ANT_HOME", with ANT_HOME being the fully expanded location of Ant, not an environment variable. This is due to the fact that the NetWare System Console has no notion of a current working directory.

      It is suggested that you create up an ant.ncf that sets up these parameters, and calls perl ANT_HOME/dist/bin/runant.pl

      -

      The following is an example of such an NCF file(assuming ant is installed in 'sys:/apache-ant/'):

      - -    envset CLASSPATH=SYS:/apache-ant/bootstrap/lib/ant.jar
      -    envset CLASSPATH=$CLASSPATH;SYS:/apache-ant/lib/optional/junit.jar
      -    envset CLASSPATH=$CLASSPATH;SYS:/apache-ant/bootstrap/lib/optional.jar
      -
      -    setenv ANT_OPTS=-envCWD=sys:/apache-ant
      -    envset ANT_OPTS=-envCWD=sys:/apache-ant
      -    setenv ANT_HOME=sys:/apache-ant/dist/lib
      -    envset ANT_HOME=sys:/apache-ant/dist/lib
      -
      -    perl sys:/apache-ant/dist/bin/runant.pl
      -
      +

      The following is an example of such an NCF file (assuming Ant is installed in 'sys:/apache-ant/'):

      +
      +      envset CLASSPATH=SYS:/apache-ant/bootstrap/lib/ant.jar
      +      envset CLASSPATH=$CLASSPATH;SYS:/apache-ant/lib/optional/junit.jar
      +      envset CLASSPATH=$CLASSPATH;SYS:/apache-ant/bootstrap/lib/optional.jar
      +
      +      setenv ANT_OPTS=-envCWD=sys:/apache-ant
      +      envset ANT_OPTS=-envCWD=sys:/apache-ant
      +      setenv ANT_HOME=sys:/apache-ant/dist/lib
      +      envset ANT_HOME=sys:/apache-ant/dist/lib
      +
      +      perl sys:/apache-ant/dist/bin/runant.pl
      +

      Ant works on JVM version 1.3 or higher. You may have some luck running it on JVM 1.2, but serious problems have been found running Ant on JVM 1.1.7B. These problems are caused by JVM bugs that will not be fixed.

      JVM 1.3 is supported on Novell NetWare versions 5.1 and higher.

      -

      Other platforms

      -Support for other platforms is not guaranteed to be complete, as certain +Support for other platforms is not guaranteed to be complete, as certain techniques to hide platform details from build files need to be written and tested on every particular platform. Contributions in this area are welcome. - + diff --git a/manual/projecthelper.html b/manual/projecthelper.html index 2e43f7933..49616949c 100644 --- a/manual/projecthelper.html +++ b/manual/projecthelper.html @@ -25,7 +25,7 @@

      The Apache Ant frontend: ProjectHelper

      -

      What is a ProjectHelper?

      +

      What is a ProjectHelper?

      The ProjectHelper in Apache Ant is responsible for parsing the build file @@ -53,7 +53,7 @@ write different build files in different languages and have them import each other.

      -

      How is Ant is selecting the proper ProjectHelper

      +

      How is Ant is selecting the proper ProjectHelper

      Ant knows about several implementations of ProjectHelper @@ -61,7 +61,7 @@ and has to decide which to use for each build file.

      At startup Ant lists the all implementations found and keeps them -in the same order they've been found in an internal 'repository': + in the same order they've been found in an internal 'repository':

      • the first to be searched for is the one declared by the system property org.apache.tools.ant.ProjectHelper (see @@ -76,7 +76,7 @@ in the same order they've been found in an internal 'repository':
      • last but not least it will add its default ProjectHelper that can parse classical build.xml files.
      -In case of an error while trying to instantiate a ProjectHelper, Ant +

      In case of an error while trying to instantiate a ProjectHelper, Ant will log an error but won't stop. If you want further debugging info about the ProjectHelper internal 'repository', use the system property ant.project-helper-repo.debug and set it to @@ -97,7 +97,7 @@ a default input file. It will iterate over list of ProjectHelpers and will select the first one that expects a default file that actually exist.

      -

      Writing your own ProjectHelper

      +

      Writing your own ProjectHelper

      The class org.apache.tools.ant.ProjectHelper is the API expected to @@ -111,6 +111,7 @@ constructor with no arguments.

      There are some functions that will help you define what your helper is capable of and what is is expecting: +

      • getDefaultBuildFile(): defines which file name is expected if none provided
      • @@ -125,11 +126,11 @@ capable of and what is is expecting: descriptor if your implementation returned true for the previous method.
      -

      Now that you have your implementation ready, you have to declare it to Ant. Three solutions here: +

      • use the system property org.apache.tools.ant.ProjectHelper (see also the Java System Properties);
      • @@ -143,8 +144,6 @@ solutions here: 'repository'. Then your helper can be used on the next call to the import task.
      -

      - diff --git a/manual/properties.html b/manual/properties.html index 226972ae0..54d231df3 100644 --- a/manual/properties.html +++ b/manual/properties.html @@ -43,14 +43,14 @@ the ant, antcall or subant tasks and make it available to the calling build process, though.

      -

      Starting with Ant 1.8.0 +

      Since Ant 1.8.0 the local task can be used to create properties that are locally scoped to a target or a sequential element like the one of the macrodef task.

      -

      Built-in Properties

      +

      Built-in Properties

      Ant provides access to all system properties as if they had been defined using a <property> task. For @@ -105,7 +105,7 @@ ant.library.dir the directory that has been used to load Ant's jars from. In most cases this is ANT_HOME/lib. -

      PropertyHelpers

      +

      PropertyHelpers

      Ant's property handling is accomplished by an instance of org.apache.tools.ant.PropertyHelper associated with @@ -210,7 +210,6 @@ public class ToStringEvaluator implements PropertyHelper.PropertyEvaluator { } -

      Property Expansion

      When Ant encounters a construct ${some-text} the @@ -238,7 +237,7 @@ public class ToStringEvaluator implements PropertyHelper.PropertyEvaluator {

      if the property builddir has the value build/classes.

      - +

      In order to maintain backward compatibility with older Ant releases, a single '$' character encountered apart from a property-like construct (including a matched pair of french @@ -284,8 +283,8 @@ public class ToStringEvaluator implements PropertyHelper.PropertyEvaluator { Antlib provides a few interesting evaluators but there are also a few built-in ones.

      -

      Getting the value of a Reference with - ${toString:}

      +

      Getting the value of a Reference with + ${toString:}

      Any Ant type which has been declared with a reference can also its string value extracted by using the ${toString:} @@ -305,8 +304,8 @@ public class ToStringEvaluator implements PropertyHelper.PropertyEvaluator {

      There is no guarantee that external types provide meaningful information in such a situation

      -

      Getting the value of a Reference with - ${ant.refid:}

      +

      Getting the value of a Reference with + ${ant.refid:}

      Any Ant type which has been declared with a reference can also be used as a property by using the ${ant.refid:} @@ -332,7 +331,7 @@ public void setAttr(Resource r) { ... } <my:task attr="${ant.refid:anturl}"/> -

      If/Unless Attributes

      +

      If/Unless Attributes

      The <target> element and various tasks (such as <fail>) and task elements (such as <test> @@ -357,7 +356,7 @@ public void setAttr(Resource r) { ... } <target name="lots-of-stuff" depends="use-file,other-unconditional-stuff"/>

      - As of Ant 1.8.0, you may instead use property expansion; a value of + Since Ant 1.8.0, you may instead use property expansion; a value of true (or on or yes) will enable the item, while false (or off or no) will disable it. Other values are still assumed to be property @@ -402,3 +401,4 @@ public void setAttr(Resource r) { ... } + diff --git a/manual/proxy.html b/manual/proxy.html index 13ef6e8ed..f614803b4 100644 --- a/manual/proxy.html +++ b/manual/proxy.html @@ -31,7 +31,6 @@ Consult your IDE documentation for IDE-specific information upon proxy setup.

      - All tasks and threads running in Ant's JVM share the same HTTP/FTP/Socks proxy configuration.

      @@ -56,13 +55,11 @@ proxy configuration.

      - - -

      Java1.5+ proxy support (new for Ant1.7)

      +

      Java1.5+ proxy support (since Ant 1.7)

      When Ant starts up, if the -autoproxy command is supplied, Ant sets the - java.net.useSystemProxies system property. This tells + java.net.useSystemProxies system property. This tells a Java1.5+ JVM to use the current set of property settings of the host environment. Other JVMs, such as the Kaffe and Apache Harmony runtimes, may also use this property in future. @@ -91,8 +88,8 @@ The java.net.useSystemProxies is checked only once, at startup time, the other checks (registry, gconf, system properties) are done dynamically whenever needed (socket connection, URL connection etc..).

      -
      Windows
      +
      Windows

      The JVM goes straight to the registry, bypassing WinInet, as it is not present/consistent on all supported Windows platforms (it is part of IE, @@ -100,7 +97,6 @@ really). Java 7 may use the Windows APIs on the platforms when it is present.

      Linux
      -

      The JVM uses the gconf library to look at specific entries. The GConf-2 settings used are: @@ -128,7 +124,6 @@ If you are using KDE or another GUI than Gnome, you can still use the gconf-editor tool to add these entries.

      -

      Manual JVM options

      Any JVM can have its proxy options explicitly configured by passing @@ -139,7 +134,7 @@ If you are using KDE or another GUI than Gnome, you can still use the

      For bash: -

      +

           export ANT_OPTS="-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080"
       
      @@ -153,30 +148,29 @@ by all continuous integration tools running on the system that call Ant via the command line.

      - For Windows, set the ANT_OPTS environment variable in the appropriate "My Computer" + For Windows, set the ANT_OPTS environment variable in the appropriate "My Computer" properties dialog box (winXP), "Computer" properties (Vista)

      - This mechanism works across Java versions, is cross-platform and reliable. + This mechanism works across Java versions, is cross-platform and reliable. Once set, all build files run via the command line will automatically have their proxy setup correctly, without needing any build file changes. It also apparently overrides Ant's automatic proxy settings options.

      -

      +

      It is limited in the following ways: -

      +

      1. Does not work under IDEs. These need their own proxy settings changed
      2. Not dynamic enough to deal with laptop configuration changes.
      -

      SetProxy Task

      The setproxy task can be used to - explicitly set a proxy in a build file. This manipulates the many proxy - configuration properties of a JVM, and controls the proxy settings for all - network operations in the same JVM from that moment. + explicitly set a proxy in a build file. This manipulates the many proxy + configuration properties of a JVM, and controls the proxy settings for all + network operations in the same JVM from that moment.

      If you have a build file that is only to be used in-house, behind a firewall, on @@ -186,10 +180,9 @@ command line. the many possible proxy options of different users (none, HTTP, SOCKS).

      -

      Note that proxy configurations set with this task will probably override - any set by other mechanisms. It can also be used with fancy tricks to + any set by other mechanisms. It can also be used with fancy tricks to only set a proxy if the proxy is considered reachable:

      @@ -214,10 +207,10 @@ command line.

      Custom ProxySelector implementations

      - As Java lets developers write their own ProxySelector implementations, it + As Java lets developers write their own ProxySelector implementations, it is theoretically possible for someone to write their own proxy selector class that uses different policies to determine proxy settings. There is no explicit support - for this in Ant, and it has not, to the team's knowledge, been attempted. + for this in Ant, and it has not, to the team's knowledge, been attempted.

      This could be the most flexible of solutions, as one could easily imagine @@ -239,14 +232,15 @@ command line. fork="true" will pick up the Ant's settings. If you need different values, set fork="false" and provide the values in <sysproperty> elements. -

      +

      +

      If you wish to have - a forked process pick up the Ant's settings, use the + a forked process pick up the Ant's settings, use the <syspropertyset> element to propagate the normal proxy settings. The following propertyset is a datatype which can be referenced in a <java> task to pass down the current values. - +

       <propertyset id="proxy.properties">
      diff --git a/manual/running.html b/manual/running.html
      index dac2ef31b..56b03b275 100644
      --- a/manual/running.html
      +++ b/manual/running.html
      @@ -25,7 +25,7 @@
       
       
       

      Running Apache Ant

      -

      Command Line

      +

      Command Line

      If you've installed Apache Ant as described in the Installing Ant section, running Ant from the command-line is simple: just type @@ -36,10 +36,10 @@ build file and runs the target specified in the default attribute of the <project> tag. To make Ant use a build file other than build.xml, use the command-line -option -buildfile file, +option -buildfile file, where file is the name of the build file you want to use (or a directory containing a build.xml file).

      -If you use the -find [file] option, +If you use the -find [file] option, Ant will search for a build file first in the current directory, then in the parent directory, and so on, until either a build file is found or the root of the filesystem has been reached. By default, it will look for a build file @@ -47,13 +47,13 @@ called build.xml. To have it search for a build file other than build.xml, specify a file argument. Note: If you include any other flags or arguments on the command line after -the -find flag, you must include the file argument -for the -find flag, even if the name of the +the -find flag, you must include the file argument +for the -find flag, even if the name of the build file you want to find is build.xml.

      You can also set properties on the command line. This can be done with -the -Dproperty=value option, +the -Dproperty=value option, where property is the name of the property, and value is the value for that property. If you specify a property that is also set in the build file @@ -63,8 +63,8 @@ command line will override the value specified in the build file. Defining properties on the command line can also be used to pass in the value of environment variables; just pass --DMYVAR=%MYVAR% (Windows) or --DMYVAR=$MYVAR (Unix) +-DMYVAR=%MYVAR% (Windows) or +-DMYVAR=$MYVAR (Unix) to Ant. You can then access these variables inside your build file as ${MYVAR}. You can also access environment variables using the @@ -73,13 +73,13 @@ You can also access environment variables using the

      Options that affect the amount of logging output by Ant are: --quiet, +-quiet, which instructs Ant to print less information to the console; --verbose, which causes Ant to print -additional information to the console; -debug, +-verbose, which causes Ant to print +additional information to the console; -debug, which causes Ant to print considerably more additional information; and --silent which makes Ant print nothing but task +-silent which makes Ant print nothing but task output and build failures (useful to capture Ant output by scripts).

      @@ -89,7 +89,7 @@ When omitted, the target that is specified in the project tag is used.

      -

      The -projecthelp option prints out a list +

      The -projecthelp option prints out a list of the build file's targets. Targets that include a description attribute are listed as "Main targets", those without a description are listed as @@ -97,7 +97,7 @@ those without a description are listed as ("Other targets" are only displayed if there are no main targets, or if Ant is invoked in -verbose or -debug mode). -

      Command-line Options Summary

      +

      Command-line Options Summary

      ant [options] [target [target2 [target3] ...]]
       Options:
         -help, -h              print this message and exit
      @@ -139,20 +139,20 @@ Options:
       Loggers & Listeners.
       

      For more information about -inputhandler see InputHandler. -

      Easiest way of changing the exit-behaviour is subclassing the original main class: +

      Easiest way of changing the exit-behaviour is subclassing the original main class:

       public class CustomExitCode extends org.apache.tools.ant.Main {
           protected void exit(int exitCode) {
               // implement your own behaviour, e.g. NOT exiting the JVM
           }
       }
      -
      and starting Ant with access (-lib path-to-class) to this class. -

      +
      +

      and starting Ant with access (-lib path-to-class) to this class.

      -

      Library Directories

      +

      Library Directories

      Prior to Ant 1.6, all jars in the ANT_HOME/lib would be added to the CLASSPATH -used to run Ant. This was done in the scripts that started Ant. From Ant 1.6, + used to run Ant. This was done in the scripts that started Ant. Since Ant 1.6, two directories are scanned by default and more can be added as required. The default directories scanned are ANT_HOME/lib and a user specific directory, ${user.home}/.ant/lib. This arrangement allows the Ant installation to be @@ -180,7 +180,6 @@ option. Ant itself is started with a very minimalistic classpath. Ant should work perfectly well with an empty CLASSPATH environment variable, something the the -noclasspath option actually enforces. We get many more support calls related to classpath problems (especially quoting problems) than we like. -

      @@ -229,9 +228,7 @@ to the value build/classes.

      adds two jars to Ants classpath.

      - - -

      Files

      +

      Files

      The Ant wrapper script for Unix will source (read and evaluate) the file ~/.antrc before it does anything. On Windows, the Ant @@ -240,7 +237,7 @@ wrapper batch-file invokes %HOME%\antrc_pre.bat at the start and files, for example, to set/unset environment variables that should only be visible during the execution of Ant. See the next section for examples.

      -

      Environment Variables

      +

      Environment Variables

      The wrapper scripts use the following environment variables (if set):

      @@ -255,24 +252,24 @@ set):

    13. ANT_ARGS - Ant command-line arguments. For example, set ANT_ARGS to point to a different logger, include a - listener, and to include the -find flag.
    14. + listener, and to include the -find flag.
      Note: If you include -find in ANT_ARGS, you should include the name of the build file - to find, even if the file is called build.xml. + to find, even if the file is called build.xml. -

      Java System Properties

      +

      Java System Properties

      Some of Ant's core classes can be configured via system properties.

      Here is the result of a search through the codebase. Because system properties are -available via Project instance, I searched for them with a + available via Project instance, I searched for them with a

           grep -r -n "getPropert" * > ..\grep.txt
       
      -command. After that I filtered out the often-used but not-so-important values (most of them +

      command. After that I filtered out the often-used but not-so-important values (most of them read-only values): path.separator, ant.home, basedir, user.dir, os.name, line.separator, java.home, java.version, java.version, user.home, java.class.path
      And I filtered out the getPropertyHelper access.

      - +
      @@ -291,12 +288,11 @@ And I filtered out the getPropertyHelper access.

      - - - + - - + @@ -314,8 +309,7 @@ org.apache.tools.ant.Executor implementation specified here. <import>-ed files, - - +
      property name valid values /default value
      ant.executor.class classname; default is org. apache. tools. ant. helper. DefaultExecutorSince Ant 1.6.3 Ant will delegate Target invocation to the + Since Ant 1.6.3 Ant will delegate Target invocation to the org.apache.tools.ant.Executor implementation specified here.
      ant.file read only: full filename of the build file This is set to the name of the build file. In @@ -304,8 +300,7 @@ org.apache.tools.ant.Executor implementation specified here. <import>-ed files, this is set to the containing build file.
      ant.file.* read only: full filename of the build file of Ant projects
      ant.input.properties filename (required) Name of the file holding the values for the @@ -509,7 +503,7 @@ the return code of the java program. So a successful build returns 0, failed builds return other values.

      -

      Cygwin Users

      +

      Cygwin Users

      The Unix launch script that come with Ant works correctly with Cygwin. You should not have any problems launching Ant from the Cygwin shell. It is important to note, however, that once Ant is running it is part of the JDK @@ -521,7 +515,7 @@ shell from which Ant was launched. You can use an executable name such as "sh" and rely on that command being available in the Windows path.

      -

      OS/2 Users

      +

      OS/2 Users

      The OS/2 launch script was developed to perform complex tasks. It has two parts: ant.cmd which calls Ant and antenv.cmd which sets the environment for Ant. Most often you will just call ant.cmd using the same command line options as described @@ -552,8 +546,8 @@ shell (of course unless called automatically from ant.cmd). It is t

      Scripts envset.cmd and runrc.cmd perform auxiliary tasks. All scripts have some documentation inside.

      -

      Running Ant as a background process on - Unix(-like) systems

      +

      Running Ant as a background process on + Unix(-like) systems

      If you start Ant as a background process (like in ant &) and the build process creates another process, Ant will @@ -568,7 +562,7 @@ have some documentation inside.

      or <java> when the fork attribute is true.

      -

      Running Ant via Java

      +

      Running Ant via Java

      If you have installed Ant in the do-it-yourself way, Ant can be started from one of two entry points:

      @@ -599,11 +593,10 @@ The latter method supports the -lib, -nouserlib, -noclasspath options and will classpath possible, generally just the ant-launcher.jar.

      - - -Ant can be started in Ant via the <java> command. -Here is an example: - +

      + Ant can be started in Ant via the <java> command. + Here is an example: +

       <java
               classname="org.apache.tools.ant.launch.Launcher"
      @@ -624,8 +617,6 @@ Here is an example:
           <arg value="${sub.target}"/>
       </java>
       
      -
      - diff --git a/manual/stylesheets/style.css b/manual/stylesheets/style.css index 3e1f10cf5..a77379e32 100644 --- a/manual/stylesheets/style.css +++ b/manual/stylesheets/style.css @@ -78,6 +78,10 @@ table th { color: black; } +code { + white-space: nowrap; +} + pre { background-color: #efefef; } @@ -99,3 +103,56 @@ ul.inlinelist { padding: 0; } +div.float { + margin-top: 0.5rem; + width: 100%; + min-height: 1.5rem; + line-height: 1.5rem; + background-color: silver; +} + +div.float + table { + width: 100%; + table-layout: fixed; +} + +div.float + table th:first-child { + width: 20%; + white-space: nowrap; +} + +div.float + table tr:first-child { + width: 20%; + white-space: nowrap; +} + +span.left { + float: left; + font-family: Arial, Helvetica, sans-serif; + font-weight: bold; +} + +span.right { + float: right; +} + +span.left, span.right { + vertical-align: middle; + background-color: silver; +} + +ol.refs { + counter-reset: refs; +} + +ol.refs > li { + list-style: none; + position: relative; +} + +ol.refs > li:before { + content: "[" counter(refs, decimal) "] "; + counter-increment: refs; + position: absolute; + left: -2rem; +} diff --git a/manual/sysclasspath.html b/manual/sysclasspath.html index 5efb2086c..3c50d2682 100644 --- a/manual/sysclasspath.html +++ b/manual/sysclasspath.html @@ -24,7 +24,7 @@ -

      build.sysclasspath

      +

      build.sysclasspath

      The value of the build.sysclasspath property controls how the system classpath, i.e. the classpath in effect when Apache Ant is run, affects the behavior of classpaths in Ant. @@ -32,7 +32,7 @@ The default behavior varies from task to task.

      The values and their meanings are: - +
      diff --git a/manual/targets.html b/manual/targets.html index a778c950f..6501660d6 100644 --- a/manual/targets.html +++ b/manual/targets.html @@ -23,7 +23,7 @@ -

      Targets

      +

      Targets

      A target is a container of tasks that cooperate to reach a desired state during the build process.

      @@ -52,7 +52,7 @@ C, then B and then A is executed. Wrong! C depends on B, and B depends on A, so first A is executed, then B, then C, and finally D.

      - +
      Call-Graph:  A --> B --> C --> D

      In a chain of dependencies stretching back from a given target @@ -116,7 +116,7 @@

      If no if and no unless attribute is present, the target will always be executed.

      -

      Important: the if and unless +

      Important: the if and unless attributes only enable or disable the target to which they are attached. They do not control whether or not targets that a conditional target depends upon get executed. In fact, they do @@ -160,7 +160,7 @@

      A target has the following attributes:

      -
      valuemeaning
      only
      +
      @@ -213,7 +213,7 @@ "warn", "ignore"). since Ant 1.8.2.
      Attribute Description No. Not allowed unless - extensionOf is present. Defaults to fail. + extensionOf is present. Defaults to fail.
      @@ -236,7 +236,7 @@ don't use Ants main class as entry point and calling them from the IDE is usually possible.

      -

      Extension-Points

      +

      Extension-Points

      since Ant 1.8.0.

      @@ -248,16 +248,16 @@ is to collect targets that contribute to the desired state in their depends list.

      -

      Targets can add themselves to an extension-points's depends list via +

      Targets can add themselves to an extension-point's depends list via their extensionOf attribute. The targets that add themselves will be - added after the targets of the explicit depends-attribute of the + added after the targets of the explicit depends attribute of the extension-point, if multiple targets add themselves, their relative order is not defined.

      The main purpose of an extension-point is to act as an extension point for build files designed to be imported. In the imported - file an extension-point defines a state that must be reached and + file, an extension-point defines a state that must be reached and targets from other build files can join the depends list of said extension-point in order to contribute to that state.

      @@ -276,7 +276,6 @@
      Call-Graph:  create-directory-layout --> 'empty slot' --> compile
      -

      And you need to generate some source before compilation, then in your main build file you may use something like

      @@ -288,7 +287,6 @@
       
         
      Call-Graph:  create-directory-layout --> generate-sources  --> compile
      -

      This will ensure that the generate-sources target is executed before the compile target.

      diff --git a/manual/tasksoverview.html b/manual/tasksoverview.html index 776082c83..da2de3d21 100644 --- a/manual/tasksoverview.html +++ b/manual/tasksoverview.html @@ -23,8 +23,7 @@ - -

      Overview of Apache Ant Tasks

      +

      Overview of Apache Ant Tasks

      Given the large number of tasks available with Ant, it may be difficult to get an overall view of what each task can do. The following tables provide a short description of each task and a link to the complete @@ -38,7 +37,7 @@ documentation.

      EJB Tasks
      Execution Tasks
      File Tasks
      -Java2 Extensions Tasks
      +Java Extensions Tasks
      Logging Tasks
      Mail Tasks
      Miscellaneous Tasks
      @@ -48,38 +47,31 @@ documentation.

      SCM Tasks
      Testing Tasks
      +
      + Archive Tasks + 🔝 +
      -

      - - - - - -
      - -Archive Tasks - -[Back to top]
      - +
      - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
      Task NameDescriptionTask NameDescription
      GUnzip/BUnzip2/UnXZGUnzip/BUnzip2/UnXZ

      Expands a file packed using GZip, BZip2 or XZ.

      GZip/BZip2/XZGZip/BZip2/XZ

      Packs a file using the GZip, BZip2 or XZ algorithm. This task does not do any dependency checking; the output file is always generated

      CabCab

      Creates Microsoft CAB archive files. It is invoked similar to the Jar or Zip tasks. This task will work on @@ -88,29 +80,29 @@ documentation.

      EarEar

      An extension of the Jar task with special treatment for files that should end up in an Enterprise Application archive.

      GUnzipGUnzip

      Expands a GZip file.

      GZipGZip

      GZips a set of files.

      JarJar

      Jars a set of files.

      JlinkJlink

      Deprecated. Use the zipfileset and zipgroupfileset attributes of the Jar or @@ -118,50 +110,50 @@ documentation.

      ManifestManifest

      Creates a manifest file.

      RpmRpm

      Invokes the rpm executable to build a Linux installation file. This task currently only works on Linux or other Unix platforms with RPM support.

      SignJarSignJar

      Signs a jar or zip file with the javasign command-line tool.

      TarTar

      Creates a tar archive.

      UnjarUnjar

      Unzips a jarfile.

      UntarUntar

      Untars a tarfile.

      UnwarUnwar

      Unzips a warfile.

      UnzipUnzip

      Unzips a zipfile.

      WarWar

      An extension of the Jar task with special treatment for files that should end up in the WEB-INF/lib, WEB-INF/classes, or @@ -169,55 +161,44 @@ documentation.

      ZipZip

      Creates a zipfile.

      -

      - - - - - -
      - -Audit/Coverage Tasks -[Back to top]
      - +
      + Audit/Coverage Tasks + 🔝 +
      + +
      - + - + -
      Task NameTask Name Description
      JDependJDepend

      Invokes the JDepend parser. This parser "traverses a set of Java source-file directories and generates design-quality metrics for each Java package".

      -

      - - - - - -
      - -Compile Tasks -[Back to top]
      - +
      + Compile Tasks + 🔝 +
      + +
      - + - + - + - + - + - + - + -
      Task NameTask Name Description
      DependDepend

      Determines which classfiles are out-of-date with respect to their source, removing the classfiles of any other classes that depend on the out-of-date classes, forcing the re-compile of the removed classfiles. @@ -225,14 +206,14 @@ documentation.

      Javac task.

      JavacJavac

      Compiles the specified source file(s) within the running (Ant) VM, or in another VM if the fork attribute is specified.

      JspCJspC

      Runs the JSP compiler. It can be used to precompile JSP pages for fast initial invocation of JSP pages, deployment on a server without the full JDK installed, or simply to syntax-check the pages without @@ -243,161 +224,139 @@ documentation.

      NetRexxCNetRexxC

      Compiles a NetRexx source tree within the running (Ant) VM.

      RmicRmic

      Runs the rmic compiler on the specified file(s).

      WljspcWljspc

      Compiles JSP pages using Weblogic's JSP compiler, weblogic.jspc. (For non-Weblogic JSP compiles, see the JspC task.

      -

      - - - - - -
      - -Deployment Tasks -[Back to top]
      - +
      + Deployment Tasks + 🔝 +
      + +
      - + - +
      Task NameTask Name Description
      ServerDeployServerDeploy

      Task to run a "hot" deployment tool for vendor-specific J2EE server.

      -

      - - - - - -
      - -Documentation Tasks -[Back to top]
      - +
      + Documentation Tasks + 🔝 +
      + +
      - + - + -
      Task NameTask Name Description
      Javadoc/Javadoc2Javadoc/Javadoc2

      Generates code documentation using the javadoc tool. The Javadoc2 task is deprecated; use the Javadoc task instead.

      -

      - - - - - -
      - -EJB Tasks -[Back to top]
      - +
      + EJB Tasks + 🔝 +
      + +
      - + - +
      Task NameTask Name Description
      EJB TasksEJB Tasks

      (See the documentation describing the EJB tasks.)

      -

      - - - - - -
      - -Execution Tasks -[Back to top]
      - +
      + Execution Tasks + 🔝 +
      + +
      - + - + - + - + - + - + - + - + - + - + - + - +
      Task NameTask Name Description
      AntAnt

      Runs Ant on a supplied buildfile, optionally passing properties (with possibly new values). This task can be used to build sub-projects.

      AntCallAntCall

      Runs another target within the same buildfile, optionally passing properties (with possibly new values).

      Apply/ExecOnApply/ExecOn

      Executes a system command. When the os attribute is specified, the command is only executed when Ant is run on one of the specified operating systems.

      DependsetDependset

      This task compares a set of source files with a set of target files. If any of the source files is newer than any of the target files, all the target files are removed.

      ExecExec

      Executes a system command. When the os attribute is specified, the command is only executed when Ant is run on one of the specified operating systems.

      JavaJava

      Executes a Java class within the running (Ant) VM, or in another VM if the fork attribute is specified.

      ParallelParallel

      A container task that can contain other Ant tasks. Each nested task specified within the <parallel> tag will be executed in its own thread.

      SequentialSequential

      A container task that can contain other Ant tasks. The nested tasks are simply executed in sequence. Its primary use is to support the sequential execution of a subset of tasks within @@ -405,19 +364,19 @@ documentation.

      SleepSleep

      A task for suspending execution for a specified period of time. Useful when a build or deployment process requires an interval between tasks.

      SubantSubant

      Calls a given target for all defined sub-builds. This is an extension of ant for bulk project execution.

      WaitforWaitfor

      Blocks execution until a set of specified conditions become true. This task is intended to be used with the Parallel task to synchronize @@ -425,44 +384,39 @@ documentation.

      -

      - - - - - -
      - -File Tasks -[Back to top]
      - +
      + File Tasks + 🔝 +
      + +
      - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + - - + - + - + - +
      Task NameTask Name Description
      AttribAttrib

      Changes the permissions and/or attributes of a file or all files inside the specified directories. Currently, it has effect only under Windows.

      ChecksumChecksum

      Generates a checksum for a file or set of files. This task can also be used to perform checksum verifications.

      ChgrpChgrp

      Changes the group ownership of a file or all files inside the specified directories. Currently, it has effect only under Unix.

      ChmodChmod

      Changes the permissions of a file or all files inside the specified directories. Currently, it has effect only under Unix. The permissions are also UNIX style, like the arguments for the @@ -470,91 +424,91 @@ documentation.

      ChownChown

      Changes the owner of a file or all files inside the specified directories. Currently, it has effect only under Unix.

      ConcatConcat

      Concatenates multiple files into a single one or to Ant's logging system.

      CopyCopy

      Copies a file or Fileset to a new file or directory.

      CopydirCopydir

      Deprecated. Use the Copy task instead.

      CopyfileCopyfile

      Deprecated. Use the Copy task instead.

      DeleteDelete

      Deletes either a single file, all files and sub-directories in a specified directory, or a set of files specified by one or more FileSets.

      DeltreeDeltree

      Deprecated. Use the Delete task instead.

      FilterFilter

      Sets a token filter for this project, or reads multiple token filters from a specified file and sets these as filters. Token filters are used by all tasks that perform file-copying operations.

      FixCRLFFixCRLF

      Modifies a file to add or remove tabs, carriage returns, linefeeds, and EOF characters.

      GetGet

      Gets a file from a URL.

      MkdirMkdir

      Creates a directory. Non-existent parent directories are created, when necessary.

      MoveMove

      Moves a file to a new file or directory, or a set(s) of file(s) to a new directory.

      PatchPatch

      Applies a "diff" file to originals.

      RenameRename

      Deprecated. Use the Move task instead.

      + RenameExtensions

      Deprecated. Use the Move task with a glob mapper @@ -562,13 +516,13 @@ documentation.

      ReplaceReplace

      Replace is a directory-based task for replacing the occurrence of a given string with another string in selected file.

      + ReplaceRegExp

      Directory-based task for replacing the occurrence of a given regular expression with a substitution pattern in a file or set of @@ -576,46 +530,41 @@ documentation.

      SetPermissionsSetPermissions

      Changes the permissions of a collection of resources.

      SyncSync

      Synchronize two directory trees.

      TempfileTempfile

      Generates a name for a new temporary file and sets the specified property to that name.

      TouchTouch

      Changes the modification time of a file and possibly creates it at the same time.

      -

      - - - - - -
      - -Java2 Extensions Tasks -[Back to top]
      - +
      + Java Extensions Tasks + 🔝 +
      + +
      - + - - - -
      Task NameTask Name Description
      + Jarlib-available

      Check whether an extension is present in a FileSet or an ExtensionSet. If the extension is present, the specified property is @@ -624,7 +573,7 @@ documentation.

      + Jarlib-display

      Display the "Optional Package" and "Package Specification" information contained within the @@ -633,7 +582,7 @@ documentation.

      + Jarlib-manifest

      Task to generate a manifest that declares all the dependencies in manifest. The dependencies are determined by looking in the @@ -643,7 +592,7 @@ documentation.

      + Jarlib-resolve

      Try to locate a jar to satisfy an extension, and place the location of the jar into the specified property.

      @@ -651,131 +600,113 @@ documentation.

      -

      -

      - - - - - -
      - -Logging Tasks -[Back to top]
      - +
      + Logging Tasks + 🔝 +
      + +
      - + - +
      Task NameTask Name Description
      RecordRecord

      Runs a listener that records the logging output of the build-process events to a file. Several recorders can exist at the same time. Each recorder is associated with a file.

      -

      - - - - - -
      - -Mail Tasks -[Back to top]
      - +
      + Mail Tasks + 🔝 +
      + +
      - + - + - + -
      Task NameTask Name Description
      MailMail

      A task to send SMTP email.

      MimeMailMimeMail

      Deprecated. Use the Mail task instead.

      -

      - - - - - -
      - -Miscellaneous Tasks -[Back to top]
      - +
      + Miscellaneous Tasks + 🔝 +
      + +
      - + - + - + - + - + - - + - + - + - + - + - + - + - + - + - + - +
      Task NameTask Name Description
      DefaultexcludesDefaultexcludes

      Modify the list of default exclude patterns from within your build file.

      EchoEcho

      Echoes text to System.out or to a file.

      FailFail

      Exits the current build by throwing a BuildException, optionally printing additional information.

      GenKeyGenKey

      Generates a key in keystore.

      HostInfoHostInfo

      Sets properties related to the provided host, or to the host the process is run on.

      InputInput

      Allows user interaction during the build process by displaying a message and reading a line of input from the console.

      ScriptScript

      Executes a script in a Apache BSF-supported language.

      SoundSound

      Plays a sound file at the end of the build, according to whether the build failed or succeeded.

      SplashSplash

      Displays a splash screen.

      SqlSql

      Executes a series of SQL statements via JDBC to a database. Statements can either be read in from a text file using the src attribute, or from between the enclosing SQL @@ -783,85 +714,80 @@ documentation.

      TaskdefTaskdef

      Adds a task definition to the current project, such that this new task can be used in the current project.

      TStampTStamp

      Sets the DSTAMP, TSTAMP, and TODAY properties in the current project, based on the current date and time.

      TypedefTypedef

      Adds a data-type definition to the current project, such that this new type can be used in the current project.

      XmlValidateXmlValidate

      Checks that XML files are valid (or only well-formed). This task uses the XML parser that is currently used by Ant by default, but any SAX1/2 parser can be specified, if needed.

      -

      - - - - - -
      - -Pre-process Tasks -[Back to top]
      - +
      + Pre-process Tasks + 🔝 +
      + +
      - + - + - + - + - + - + - + - + - + - + - - + - + - + -
      Task NameTask Name Description
      ANTLRANTLR

      Invokes the ANTLR Translator generator on a grammar file.

      AntStructureAntStructure

      Generates a DTD for Ant buildfiles that contains information about all tasks currently known to Ant.

      ImportImport

      Import another build file and potentially override targets in it with targets of your own.

      IncludeInclude

      Include another build file.

      JavaCCJavaCC

      Invokes the JavaCC compiler-compiler on a grammar file.

      JavahJavah

      Generates JNI headers from a Java class.

      JJDocJJDoc

      Invokes the JJDoc documentation generator for the JavaCC compiler-compiler. JJDoc takes a JavaCC parser specification and produces documentation @@ -871,7 +797,7 @@ documentation.

      JJTreeJJTree

      Invokes the JJTree preprocessor for the JavaCC compiler-compiler. It inserts parse-tree building actions at various places in the JavaCC source that @@ -881,12 +807,12 @@ documentation.

      MacrodefMacrodef

      Define a new task as a macro built-up upon other tasks.

      + Native2Ascii

      Converts files from native encodings to ASCII with escaped Unicode. A common usage is to convert source files maintained in a native @@ -894,84 +820,75 @@ documentation.

      PresetdefPresetdef

      Define a new task by instrumenting an existing task with default values for attributes or child elements.

      TranslateTranslate

      Identifies keys in files, delimited by special tokens, and translates them with values read from resource bundles.

      XSLTXSLT

      Processes a set of documents via XSLT.

      -

      - - - - - -
      - -Property Tasks -[Back to top]
      - +
      + Property Tasks + 🔝 +
      + +
      - + - + - + - + - + - + - + - + - + - + - + - + - - + - + - +
      Task NameTask Name Description
      AvailableAvailable

      Sets a property if a specified file, directory, class in the classpath, or JVM system resource is available at runtime.

      BasenameBasename

      Sets a property to the last element of a specified path.

      BuildNumberBuildNumber

      Task that can be used to track build numbers.

      ConditionCondition

      Sets a property if a certain condition holds true; this is a generalization of Available and Uptodate.

      DirnameDirname

      Sets a property to the value of the specified file up to, but not including, the last path element.

      - Echoproperties
      - -
      Echoproperties

      Lists the current properties.

      LoadFileLoadFile

      Loads a file into a property.

      LoadPropertiesLoadProperties

      Load a file's contents as Ant properties. This task is equivalent to using <property file="..."/> except that it supports nested <filterchain> elements, @@ -979,12 +896,12 @@ documentation.

      MakeURLMakeURL

      Creates a URL (list) from a file/fileset or path

      PathConvertPathConvert

      Converts a nested path, path reference, filelist reference, or fileset reference to the form usable on a specified platform and/or to a list of items separated by the specified separator and stores @@ -992,13 +909,13 @@ documentation.

      PropertyProperty

      Sets a property (by name and value), or set of properties (from a file or resource) in the project.

      + PropertyFile

      Creates or modifies property files. Useful when wanting to make unattended modifications to configuration files for application @@ -1008,132 +925,121 @@ documentation.

      UptodateUptodate

      Sets a property if a given target file is newer than a set of source files.

      WhichresourceWhichresource

      Find a class or resource.

      XmlPropertyXmlProperty

      Loads property values from a well-formed XML file.

      -

      - - - - - -
      - -Remote Tasks -[Back to top]
      - +
      + Remote Tasks + 🔝 +
      + +
      - + - + - + - + - + - + - + -
      Task NameTask Name Description
      FTPFTP

      Implements a basic FTP client that can send, receive, list, and delete files, and create directories.

      RexecRexec

      Task to automate a remote rexec session.

      ScpScp

      Copy files to or from a remote server using SSH.

      setproxysetproxy

      Sets Java's web proxy properties, so that tasks and code run in the same JVM can have through-the-firewall access to remote web sites.

      SshexecSshexec

      Execute a command on a remote server using SSH.

      TelnetTelnet

      Task to automate a remote telnet session. This task uses nested <read> and <write> tags to indicate strings to wait for and specify text to send.

      -

      - - - - - -
      - -SCM Tasks -[Back to top]
      - +
      + SCM Tasks + 🔝 +
      + +
      - + - + - + - + - + - + - + - - - - + - + -
      Task NameTask Name Description
      CvsCvs

      Handles packages/modules retrieved from a CVS repository.

      CvsChangeLogCvsChangeLog

      Generates an XML report of the changes recorded in a CVS repository.

      CVSPassCVSPass

      Adds entries to a .cvspass file. Adding entries to this file has the same affect as a cvs login command.

      CvsTagDiffCvsTagDiff

      Generates an XML-formatted report file of the changes between two tags or dates recorded in a CVS repository.

      ClearCaseClearCase

      Tasks to perform the ClearCase cleartool checkin, checkout, uncheckout, update, lock, unlock, mklbtype, rmtype, mklabel, mkattr, mkdir, mkelem, and mkbl commands.

      Continuus/SynergyContinuus/Synergy

      Tasks to perform the Continuus ccmcheckin, ccmcheckout, ccmcheckintask, ccmreconfigure, and ccmcreateTask commands.

      + Microsoft Visual SourceSafe

      Tasks to perform the Visual SourceSafe vssget, vsslabel, vsshistory, vsscheckin, @@ -1141,57 +1047,45 @@ documentation.

      commands.

      PvcsPvcs

      Allows the user extract the latest edition of the source code from a PVCS repository.

      SourceOffSiteSourceOffSite

      Tasks to perform the SourceOffSite sosget, soslabel, soscheckin, and soscheckout commands.

      -

      - - - - - -
      - -Testing Tasks -[Back to top]
      - +
      + Testing Tasks + 🔝 +
      + +
      - + - + - + -
      Task NameTask Name Description
      JunitJunit

      Runs tests from the Junit testing framework. This task has been tested with JUnit 3.0 up to JUnit 3.7; it won't work with versions prior to JUnit 3.0.

      JunitReportJunitReport

      Merges the individual XML files generated by the Junit task and applies a stylesheet on the resulting merged document to provide a browsable report of the testcases results.

      - - - diff --git a/manual/toc.html b/manual/toc.html index 91d982426..cee658885 100644 --- a/manual/toc.html +++ b/manual/toc.html @@ -48,4 +48,3 @@ - diff --git a/manual/tutorial-HelloWorldWithAnt.html b/manual/tutorial-HelloWorldWithAnt.html index babd9b43c..938204593 100644 --- a/manual/tutorial-HelloWorldWithAnt.html +++ b/manual/tutorial-HelloWorldWithAnt.html @@ -22,29 +22,25 @@

      Tutorial: Hello World with Apache Ant

      -

      This document provides a step by step tutorial for starting java programming with Apache Ant. +

      This document provides a step by step tutorial for starting Java programming with Apache Ant. It does not contain deeper knowledge about Java or Ant. This tutorial has the goal to let you see, how to do the easiest steps in Ant.

      - -

      Content

      -

      - -

      Preparing the project

      +

      Preparing the project

      We want to separate the source from the generated files, so our java source files will be in src folder. All generated files should be under build, and there splitted into several subdirectories for the individual steps: classes for our compiled files and jar for our own JAR-file.

      -

      We have to create only the src directory. (Because I am working on Windows, here is +

      We have to create only the src directory. (Because I am working on Windows, here is the win-syntax - translate to your shell):

      @@ -64,7 +60,7 @@ public class HelloWorld {
       }
       
      -

      Now just try to compile and run that: +

      Now just try to compile and run that:

       md build\classes
       javac -sourcepath src -d build\classes src\oata\HelloWorld.java
      @@ -74,7 +70,6 @@ which will result in
       
       Hello World
       
      -

      Creating a jar-file is not very difficult. But creating a startable jar-file needs more steps: create a manifest-file containing the start class, creating the target directory and archiving the files.

      @@ -85,12 +80,10 @@ jar cfm build\jar\HelloWorld.jar myManifest -C build\classes . java -jar build\jar\HelloWorld.jar
      -

      Note: Do not have blanks around the >-sign in the echo Main-Class instruction because it would +

      Note: Do not have blanks around the >-sign in the echo Main-Class instruction because it would falsify it!

      - - -

      Four steps to a running application

      +

      Four steps to a running application

      After finishing the java-only step we have to think about our build process. We have to compile our code, otherwise we couldn't start the program. Oh - "start" - yes, we could provide a target for that. We should package our application. Now it's only one class - but if you want to provide a download, no one would download several hundreds files ... @@ -138,7 +131,7 @@ ant run ant compile jar run

      -

      While having a look at the buildfile, we will see some similar steps between Ant and the java-only commands: +

      While having a look at the buildfile, we will see some similar steps between Ant and the Java-only commands:

      @@ -182,19 +175,14 @@ java -jar build\jar\HelloWorld.jar <java jar="build/jar/HelloWorld.jar" fork="true"/>
      java-only
      -

      - - - -

      Enhance the build file

      +

      Enhance the build file

      Now we have a working buildfile we could do some enhancements: many time you are referencing the same directories, main-class and jar-name are hard coded, and while invocation you have to remember the right order of build steps.

      The first and second point would be addressed with properties, the third with a special property - an attribute of the <project>-tag and the fourth problem can be solved using dependencies.

      -
       <project name="HelloWorld" basedir="." default="main">
       
      @@ -237,7 +225,6 @@ of the <project>-tag and the fourth problem can be solved using dependenci
       </project>
       
      -

      Now it's easier, just do a ant and you will get

       Buildfile: build.xml
      @@ -260,16 +247,15 @@ main:
       BUILD SUCCESSFUL
       
      - - -

      Using external libraries

      +

      Using external libraries

      Somehow told us not to use syso-statements. For log-Statements we should use a Logging-API - customizable on a high -degree (including switching off during usual life (= not development) execution). We use Log4J for that, because

        +degree (including switching off during usual life (= not development) execution). We use Log4J for that, because

        +
        • it is not part of the JDK (1.4+) and we want to show how to use external libs
        • it can run under JDK 1.2 (as Ant)
        • it's highly configurable
        • it's from Apache ;-)
        • -

        +

      We store our external libraries in a new directory lib. Log4J can be downloaded [1] from Logging's Homepage. Create the lib directory and extract the log4j-1.2.9.jar into that lib-directory. After that we have to modify @@ -340,25 +326,24 @@ a jarname and a classpath. So add our class in the red line to the alread [java] 0 [main] INFO oata.HelloWorld - Hello World -

      What's that?

        +

        What's that?

        +
        • [java] Ant task running at the moment
        • 0 sorry don't know - some Log4J stuff
        • [main] the running thread from our application
        • -
        • INFO log level of that statement -
        • oata.HelloWorld source of that statement +
        • INFO log level of that statement
        • +
        • oata.HelloWorld source of that statement
        • - separator
        • Hello World the message
        -For another layout ... have a look inside Log4J's documentation about using other PatternLayout's.

        - +

        For another layout ... have a look inside Log4J's documentation about using other PatternLayout's.

        - -

        Configuration files

        +

        Configuration files

        Why we have used Log4J? "It's highly configurable"? No - all is hard coded! But that is not the debt of Log4J - it's ours. We had coded BasicConfigurator.configure(); which implies a simple, but hard coded configuration. More comfortable would be using a property file. In the java source delete the BasicConfiguration-line from the main() method -(and the related import-statement). Log4J will search then for a configuration as described in it's manual. Then create -a new file src/log4j.properties. That's the default name for Log4J's configuration and using that name would make +(and the related import-statement). Log4J will search then for a configuration as described in it's manual. Then create +a new file src/log4j.properties. That's the default name for Log4J's configuration and using that name would make life easier - not only the framework knows what is inside, you too!

        @@ -389,9 +374,7 @@ finished yet. We should deliver the configuration file, too. So we change the bu
         

        This copies all resources (as long as they haven't the suffix ".java") to the build directory, so we could start the application from that directory and these files will included into the jar.

        - -
        -

        Testing the class

        +

        Testing the class

        In this step we will introduce the usage of the JUnit [3] testframework in combination with Ant. Because Ant has a built-in JUnit 3.8.2 you could start directly using it. Write a test class in src\HelloWorldTest.java:

        @@ -400,14 +383,14 @@ public class HelloWorldTest extends junit.framework.TestCase { public void testNothing() { } - + public void testWillAlwaysFail() { fail("An error message"); } - + }
        -

        Because we dont have real business logic to test, this test class is very small: just show how to start. For +

        Because we dont have real business logic to test, this test class is very small: just show how to start. For further information see the JUnit documentation [3] and the manual of junit task. Now we add a junit instruction to our buildfile:

        @@ -424,14 +407,14 @@ Now we add a junit instruction to our buildfile:

        </classpath> </java> </target> - + <target name="junit" depends="jar"> <junit printsummary="yes"> <classpath> <path refid="classpath"/> <path refid="application"/> </classpath> - + <batchtest fork="yes"> <fileset dir="${src.dir}" includes="*Test.java"/> </batchtest> @@ -462,7 +445,7 @@ BUILD SUCCESSFUL ... -

        We can also produce a report. Something that you (and other) could read after closing the shell .... +

        We can also produce a report. Something that you (and other) could read after closing the shell .... There are two steps: 1. let <junit> log the information and 2. convert these to something readable (browsable).

        @@ -476,15 +459,15 @@ There are two steps: 1. let <junit> log the information and 2. convert the
                         <path refid="classpath"/>
                         <path refid="application"/>
                     </classpath>
        -            
        +
                     <formatter type="xml"/>
        -            
        +
                     <batchtest fork="yes" todir="${report.dir}">
                         <fileset dir="${src.dir}" includes="*Test.java"/>
                     </batchtest>
                 </junit>
             </target>
        -    
        +
             <target name="junitreport">
                 <junitreport todir="${report.dir}">
                     <fileset dir="${report.dir}" includes="TEST-*.xml"/>
        @@ -495,26 +478,19 @@ There are two steps: 1. let <junit> log the information and 2. convert the
         
         

        Because we would produce a lot of files and these files would be written to the current directory by default, we define a report directory, create it before running the junit and redirect the logging to it. The log format -is XML so junitreport could parse it. In a second target junitreport should create a browsable +is XML so junitreport could parse it. In a second target junitreport should create a browsable HTML-report for all generated xml-log files in the report directory. Now you can open the ${report.dir}\index.html and see the result (looks something like JavaDoc).
        Personally I use two different targets for junit and junitreport. Generating the HTML report needs some time and you dont need the HTML report just for testing, e.g. if you are fixing an error or a integration server is doing a job.

        - - - - -

        Resources

        +

        Resources

             [1] http://www.apache.org/dist/logging/log4j/1.2.13/logging-log4j-1.2.13.zip
             [2] http://logging.apache.org/log4j/docs/manual.html
             [3] http://www.junit.org/index.htm
         
        - - - diff --git a/manual/tutorial-tasks-filesets-properties.html b/manual/tutorial-tasks-filesets-properties.html index 3a36e7ef0..1662fcff6 100644 --- a/manual/tutorial-tasks-filesets-properties.html +++ b/manual/tutorial-tasks-filesets-properties.html @@ -27,7 +27,7 @@ tasks [1] this tutorial explains how to get and set properties and how to us nested filesets and paths. Finally it explains how to contribute tasks to Apache Ant.

        Content

        -

        -

        The goal

        +

        The goal

        The goal is to write a task, which searchs in a path for a file and saves the location of that file in a property.

        - -

        Build environment

        +

        Build environment

        We can use the buildfile from the other tutorial and modify it a little bit. That's the advantage of using properties - we can reuse nearly the whole script. :-)

        @@ -65,10 +63,9 @@ That's the advantage of using properties - we can reuse nearly the whole script.
         tutorial-tasks-filesets-properties.zip [2] in /build.xml.01-propertyaccess
         (future version saved as *.02..., final version as build.xml; same for sources).

        - -

        Property access

        +

        Property access

        Our first step is to set a property to a value and print the value of that property. -So our scenario would be + So our scenario would be

             <find property="test" value="test-value"/>
             <find print="test"/>
        @@ -78,9 +75,9 @@ ok, can be rewritten with the core tasks
             <property name="test" value="test-value"/>
             <echo message="${test}"/>
         
        -but I have to start on known ground :-)

        +

        but I have to start on known ground :-)

        So what to do? Handling three attributes (property, value, print) and an execute method. -Because this is only an introduction example I don't do much checking: + Because this is only an introduction example I don't do much checking:

         import org.apache.tools.ant.BuildException;
        @@ -110,7 +107,7 @@ public class Find extends Task {
         }
         
        -As said in the other tutorial, the property access is done via Project instance. +

        As said in the other tutorial, the property access is done via Project instance. We get this instance via the public getProject() method which we inherit from Task (more precise from ProjectComponent). Reading a property is done via getProperty(propertyname) (very simple, isn't it?). This property returns @@ -132,7 +129,7 @@ caller.)

        to them, sorry :-)

        After putting our two line example from above into a target names use.simple -we can call that from our testcase: + we can call that from our testcase:

         import org.junit.Rule;
        @@ -161,26 +158,23 @@ public class FindTest {
         }
         
        -and all works fine.

        +

        and all works fine.

        - - -

        Using filesets

        +

        Using filesets

        Ant provides a common way of bundling files: the fileset. Because you are reading this tutorial I think you know them and I don't have to spend more explanations about their usage in buildfiles. Our goal is to search a file in path. And on this step the path is simply a fileset (or more precise: a collection of filesets). So our usage -would be +would be

             <find file="ant.jar" location="location.ant-jar">
                 <fileset dir="${ant.home}" includes="**/*.jar"/>
             </find>
         
        -

        What do we need? A task with two attributes (file, location) and nested filesets. Because we had attribute handling already explained in the example above and the -handling of nested elements is described in the other tutorial the code should be very easy: + handling of nested elements is described in the other tutorial the code should be very easy:

         public class Find extends Task {
         
        @@ -204,18 +198,19 @@ public class Find extends Task {
             }
         }
         
        -Ok - that task wouldn't do very much, but we can use it in the described manner without +

        Ok - that task wouldn't do very much, but we can use it in the described manner without failure. On next step we have to implement the execute method. And before that we will implement the appropriate testcases (TDD - test driven development).

        In the other tutorial we have reused the already written targets of our buildfile. Now we will configure most of the testcases via java code (sometimes it's much easier -to write a target than doing it via java coding). What can be tested?

          + to write a target than doing it via java coding). What can be tested?

          +
          • not valid configured task (missing file, missing location, missing fileset)
          • don't find a present file
          • behaviour if file can't be found
          -Maybe you find some more testcases. But this is enough for now.
          +

          Maybe you find some more testcases. But this is enough for now.
          For each of these points we create a testXX method.

          @@ -351,8 +346,7 @@ Therefore we have do modify our buildfile:
               </target>
           
          - -

          Using nested paths

          +

          Using nested paths

          A task providing support for filesets is a very comfortable one. But there is another possibility of bundling files: the <path>. Fileset are easy if the files are all under a common base directory. But if this is not the case you have a problem. Another disadvantage @@ -426,9 +420,7 @@ and creating-absolute-paths stuff for us. So the execute method is just:

          we see that the Path class does the work for us: no DirectoryScanner (was at 2) and no creating of the absolute path (was at 3).

          - - -

          Returning a list

          +

          Returning a list

          So far so good. But could a file be on more than one place in the path? - Of course.
          And would it be good to get all of them? - It depends on ...

          @@ -445,13 +437,14 @@ elements are concatenated and separated with a customizable separator (default '

          If the delimiter is set we will return all found files as list with that delimiter.

          -

          Therefore we have to

            +

            Therefore we have to

            +
            • provide a new attribute
            • collect more than the first file
            • delete duplicates
            • create the list if necessary
            • return that list
            • -

            +

          So we add as testcase:

          @@ -559,8 +552,7 @@ delimiter.

          Ok, first searching for all files and then returning only the first one ... You can tune the performance of your own :-)

          - -

          Documentation

          +

          Documentation

          A task is useless if the only who is able to code the buildfile is the task developer (and he only the next few weeks :-). So documentation is also very important. In which form you do that depends on your favourite. But inside Ant there is a common format and @@ -591,12 +583,12 @@ As a template we have: <body> -<h2><a name="taskname">Taskname</a></h2> +<h2& id="taskname">Taskname</h2> <h3>Description</h3> <p> Describe the task.</p> <h3>Parameters</h3> -<table border="1" cellpadding="2" cellspacing="0"> +<table> <tr> <td valign="top"><b>Attribute</b></td> <td valign="top"><b>Description</b></td> @@ -640,13 +632,13 @@ As a template we have: <body> -<h2><a name="find">Find</a></h2> +<h2 id="find">Find</h2> <h3>Description</h3> <p>Searchs in a given path for a file and returns the absolute to it as property. If delimiter is set this task returns all found locations.</p> <h3>Parameters</h3> -<table border="1" cellpadding="2" cellspacing="0"> +<table> <tr> <td valign="top"><b>Attribute</b></td> <td valign="top"><b>Description</b></td> @@ -701,9 +693,9 @@ After that it prints out the result (e.g. C:/ant-1.5.4/bin/ant.jar;C:/ant-1.6/bi </html>

          - -

          Contribute the new task

          -If we decide to contribute our task, we should do some things:
            +

            Contribute the new task

            +If we decide to contribute our task, we should do some things: +
            • is our task welcome? :-) Simply ask on the user list
            • is the right package used?
            • does the code conform to the styleguide?
            • @@ -713,7 +705,7 @@ If we decide to contribute our task, we should do some things:
              • create a patch file
              • publishing that patch file
              -The Ant Task Guidelines [6] support additional +

              The Ant Task Guidelines [6] support additional information on that.

              Now we will check the "Checklist before submitting a new task" described in that guideline. @@ -738,7 +730,6 @@ tasks to do test and patches zipped up to escape the HTML filter. to do

            -

            Package / Directories

            This task does not depend on any external library. Therefore we can use this as a core task. This task contains only one class. So we can use the standard package @@ -749,7 +740,8 @@ tests in src/etc/testcases.

            Now we integrate our work into Ants distribution. So first we do an update of our cvs tree. If not done yet, you have to checkout the ant module from Apaches cvs server as described in Access the Source Tree (AnonCVS) -[7] (password is anoncvs):

            +[7] (password is anoncvs):

            +
             cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic login                 //1
             cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout ant          //2
             
            @@ -758,7 +750,7 @@ If you have a local copy of Ants sources just do an update cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic login cd ant //3 cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic update //4 -

            +

        We use the -d flag on //1 to specify the cvs directory. You can specify the environment variable CVSROOT with that value and after that you haven�t @@ -770,14 +762,14 @@ on //4.

        Now we will build our Ant distribution and do a test. So we can see if there are any tests failing on our machine. (We can ignore these failing tests on later -steps; windows syntax used here- translate to xNIX if needed): + steps; windows syntax used here- translate to xNIX if needed):

         ANTHOME> build                                                    // 1
         ANTHOME> set ANT_HOME=%CD%\dist                                   // 2
         ANTHOME> ant test -Dtest.haltonfailure=false                      // 3
         
        -First we have to build our Ant distribution (//1). On //2 we set the ANT_HOME +

        First we have to build our Ant distribution (//1). On //2 we set the ANT_HOME environment variable to the directory where the new created distribution is stored (%CD% is expanded to the current directory on Windows 2000 and XP, on 9x and NT write it out). On //3 we let Ant do all the tests (which enforced a compile @@ -810,7 +802,7 @@ ANTHOME> ant run-single-test // 1 -Dtestcase=org.apache.tools.ant.taskdefs.FindTest // 2 -Dtest.haltonfailure=false

        -Because we only want to test our new class, we use the target for single tests, specify +

        Because we only want to test our new class, we use the target for single tests, specify the test to use and configure not to halt on the first failure - we want to see all failures of our own test (//1 + 2).

        @@ -821,7 +813,7 @@ failures of our own test (//1 + 2).

        a core task. And nobody wants to taskdef the javac, echo, ... So what to do? The answer is the src/main/.../taskdefs/default.properties. Here is the mapping between taskname and implementing class done. So we add a find=org.apache.tools.ant.taskdefs.Find as the last core -task (just before the # optional tasks line). Now a second try: + task (just before the # optional tasks line). Now a second try:

         ANTHOME> build                                                    // 1
         ANTHOME> ant run-single-test
        @@ -835,7 +827,7 @@ breaks some other tests.
         
         ANTHOME> ant test -Dtest.haltonfailure=false
         
        -Because there are a lot of tests this step requires a little bit of time. So use the run-single-test +

        Because there are a lot of tests this step requires a little bit of time. So use the run-single-test during development and do the test only at the end (maybe sometimes during development too). We use the -Dtest.haltonfailure=false here because there could be other tests fail and we have to look into them.

        @@ -843,12 +835,9 @@ to look into them.

        This test run should show us two things: our test will run and the number of failing tests is the same as directly after the cvs update (without our modifications).

        - -

        Apache license statement

        Simply copy the license text from one the other source from the Ant source tree.

        -

        Test on JDK 1.2

        Until version 1.5 Ant must be able to run on a JDK 1.1. With version 1.6 this is not a requisite any more. But JDK 1.2 is a must-to-work-with. So we have to test that. You can download older @@ -860,8 +849,6 @@ and run ant test (like above).

        Our test should pass.

        - -

        Checkstyle

        There are many things we have to ensure. Indentation with 4 spaces, blanks here and there, ... (all described in the Ant Task Guidelines [6] which @@ -875,11 +862,11 @@ for us.

        All jar's stored there are available to Ant so you haven't to add it to you %ANT_HOME%\lib directory (this feature was added with Ant 1.6).

        -

        So we will run the tests with +

        So we will run the tests with

         ANTHOME> ant -f check.xml checkstyle htmlreport
         
        -I prefer the HTML report because there are lots of messages and we can navigate faster. +

        I prefer the HTML report because there are lots of messages and we can navigate faster. Open the ANTHOME/build/reports/checkstyle/html/index.html and navigate to the Find.java. Now we see that there are some errors: missing whitespaces, unused imports, missing javadocs. So we have to do that.

        @@ -890,8 +877,6 @@ up to date and you will find the next error place much more easier without redoi

        After cleaning up the code according to the messages we delete the reports directory and do a second checkstyle run. Now our task isn't listed. That's fine :-)

        - - -

        Publish the task

        Finally we publish that archive. As described in the Ant Task Guidelines [7] we can post it on the developer mailinglist or we create a BugZilla entry. For both we need some information:

        - +
        @@ -963,31 +947,27 @@ and the steps described there if you haven't one.

        Now the new task is uploaded into the bug database. - -

        Resources

        -  [1] tutorial-writing-tasks.html
        -  [2] tutorial-tasks-filesets-properties.zip
        -  [3] properties.html#built-in-props
        -  [4] http://ant-contrib.sourceforge.net/
        -  [5] Tasks/java.html
        -  [6] http://ant.apache.org/ant_task_guidelines.html
        -  [7] http://ant.apache.org/cvs.html
        -  [8] http://www.oracle.com/technetwork/java/archive-139210.html
        -  [9] http://www.oracle.com/technetwork/java/codeconvtoc-136057.html
        -  [10] http://checkstyle.sourceforge.net/
        -  [11] http://issues.apache.org/bugzilla/
        -  [12] http://issues.apache.org/bugzilla/createaccount.cgi
        -  [13] http://issues.apache.org/bugzilla/enter_bug.cgi
        - +

        Resources

        +
          +
        1. tutorial-writing-tasks.html
        2. +
        3. tutorial-tasks-filesets-properties.zip
        4. +
        5. properties.html#built-in-props
        6. +
        7. http://ant-contrib.sourceforge.net/
        8. +
        9. Tasks/java.html
        10. +
        11. http://ant.apache.org/ant_task_guidelines.html
        12. +
        13. http://ant.apache.org/cvs.html
        14. +
        15. http://www.oracle.com/technetwork/java/archive-139210.html
        16. +
        17. http://www.oracle.com/technetwork/java/codeconvtoc-136057.html
        18. +
        19. http://checkstyle.sourceforge.net/
        20. +
        21. http://issues.apache.org/bugzilla/
        22. +
        23. http://issues.apache.org/bugzilla/createaccount.cgi
        24. +
        25. http://issues.apache.org/bugzilla/enter_bug.cgi
        26. +
        - - - - diff --git a/manual/tutorial-writing-tasks.html b/manual/tutorial-writing-tasks.html index c3b8a6a82..4c936c969 100644 --- a/manual/tutorial-writing-tasks.html +++ b/manual/tutorial-writing-tasks.html @@ -41,8 +41,7 @@ tasks.

      • Resources
      • - -

        Set up the build environment

        +

        Set up the build environment

        Apache Ant builds itself, we are using Ant too (why we would write a task if not? :-) therefore we should use Ant for our build.

        We choose a directory as root directory. All things will be done @@ -107,9 +106,7 @@ the execution of some steps before. So the refactored code is: build-in properties [1] of Ant. - - -

        Write the Task

        +

        Write the Task

        Now we write the simplest Task - a HelloWorld-Task (what else?). Create a text file HelloWorld.java in the src-directory with: @@ -123,10 +120,7 @@ public class HelloWorld { and we can compile and jar it with ant (default target is "jar" and via its depends-clause the "compile" is executed before). - - - -

        Use the Task

        +

        Use the Task

        But after creating the jar we want to use our new Task. Therefore we need a new target "use". Before we can use our new task we have to declare it with @@ -166,10 +160,7 @@ BUILD SUCCESSFUL Total time: 3 seconds - - - -

        Integration with TaskAdapter

        +

        Integration with TaskAdapter

        Our class has nothing to do with Ant. It extends no superclass and implements no interface. How does Ant know to integrate? Via name convention: our class provides a method with signature public void execute(). This class is wrapped by Ant's @@ -202,9 +193,7 @@ use: Here is project 'MyTask'. - - -

        Deriving from Ant's Task

        +

        Deriving from Ant's Task

        Ok, that works ... But usually you will extend org.apache.tools.ant.Task. That class is integrated in Ant, get's the project-reference, provides documentation fields, provides easier access to the logging facility and (very useful) gives you @@ -234,8 +223,7 @@ use: [helloworld] I am used in: C:\tmp\anttests\MyFirstTask\build.xml:23: - -

        Accessing the Task's Project

        +

        Accessing the Task's Project

        The parent project of your custom task may be accessed through method getProject(). However, do not call this from the custom task constructor, as the return value will be null. Later, when node attributes or text are set, or method execute() is called, the Project object is available.

        Here are two useful methods from class Project:

        subject short description