@@ -14,7 +14,6 @@ | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |||
<html> | |||
<head> | |||
<meta http-equiv="Content-Language" content="en-us"> | |||
@@ -31,12 +30,12 @@ | |||
administrators. But what about programmers? Can the functionality | |||
provided by Ant tasks be used in java programs?</p> | |||
<p>Yes, and its quite easy. Before getting into the details, however, | |||
<p>Yes, and its quite easy. Before getting into the details, however, | |||
we should mention the pros and cons of this approach: | |||
<h3>Pros</h3> | |||
<table cellpadding="0" margin="0" border="1"> | |||
<table> | |||
<tr> | |||
<td><b>Robust</b></td> | |||
<td> | |||
@@ -65,7 +64,7 @@ code is supported by the entire Apache Ant community. | |||
<h3>Cons</h3> | |||
<table cellpadding="0" margin="0" border="1"> | |||
<table> | |||
<tr> | |||
<td><b>Dependency on Ant Libraries</b></td> | |||
<td> | |||
@@ -86,7 +85,6 @@ open source! | |||
</tr> | |||
</table> | |||
<h2>Example</h2> | |||
<p>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!</p> | |||
</body> | |||
</html> |
@@ -25,7 +25,6 @@ | |||
<body> | |||
<h2><a href="toc.html" target="navFrame">Table of Contents</a></h2> | |||
<h3>Apache Ant Tasks</h3> | |||
@@ -25,7 +25,7 @@ | |||
<body> | |||
<h1>The Command Line Processor Plugin: ArgumentProcessor</h1> | |||
<h2><a name="definition">What is an ArgumentProcessor?</a></h2> | |||
<h2 id="definition">What is an ArgumentProcessor?</h2> | |||
<p> | |||
An <code>ArgumentProcessor</code> is a parser of command line argument which is | |||
@@ -59,7 +59,7 @@ being parsed and quit (like <code>-projectHelp</code>), or just set some | |||
custom properties on the project and let it run. | |||
</p> | |||
<h2><a name="repository">How to register it's own ArgumentProcessor</a></h2> | |||
<h2 id="repository">How to register it's own ArgumentProcessor</h2> | |||
<p>First, the <code>ArgumentProcessor</code> must be an implementation of | |||
<code>org.apache.tools.ant.ArgumentProcessor</code>. | |||
@@ -73,4 +73,3 @@ be found in Ant's classpath. | |||
</p> | |||
</body> | |||
</html> | |||
@@ -29,7 +29,7 @@ | |||
<p><strong>The links will not work in the online version of this document.</strong></p> | |||
<table border="1"> | |||
<table> | |||
<thead> | |||
<tr> | |||
<th> | |||
@@ -86,7 +86,6 @@ Abstract Base class for pack tasks. | |||
</td> | |||
</tr> | |||
<tr> | |||
<td> | |||
<a href="api/org/apache/tools/ant/taskdefs/Unpack.html">Unpack</a> | |||
@@ -108,7 +107,5 @@ Abstract Base class for tasks that may have multiple actions. | |||
</tbody> | |||
</table> | |||
</body> | |||
</html> |
@@ -24,7 +24,7 @@ | |||
<body> | |||
<h2><a name="clonevm">ant.build.clonevm</a></h2> | |||
<h2 id="clonevm">ant.build.clonevm</h2> | |||
<p><em>Since Apache Ant 1.7</em></p> | |||
@@ -46,7 +46,5 @@ build.sysclasspath had the value "last".</p> | |||
specified on the Ant command line. Use the ANT_OPTS environment | |||
variable instead.</p> | |||
</body> | |||
</html> | |||
@@ -22,19 +22,18 @@ | |||
<title>Apache Ant 1.10.3 User Manual</title> | |||
</head> | |||
<body bgcolor="#FFFFFF"> | |||
<div align="center"> | |||
<body> | |||
<div align="center"> | |||
<h1><img src="images/ant_logo_large.gif" width="190" height="120"></h1> | |||
<h1>Apache Ant™ 1.10.3 Manual</h1> | |||
<p align="left">This is the manual for version 1.10.3 of | |||
<a target="_top" href="http://ant.apache.org/index.html">Apache Ant</a>. | |||
If your version | |||
of Ant (as verified with <tt>ant -version</tt>) is older or newer than this | |||
version then this is not the correct manual set. Please use the documentation | |||
<a target="_top" href="http://ant.apache.org/index.html">Apache Ant</a>. | |||
If your version | |||
of Ant (as verified with <tt>ant -version</tt>) 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. </p> | |||
<p> </p> | |||
<p align="left">Ant's manual and API documentation is part of | |||
the <a href="http://ant.apache.org/bindownload.cgi">binary</a> | |||
@@ -48,6 +47,5 @@ | |||
<p>Apache Ant, Apache Ivy, Ant, Ivy, Apache, the Apache feather logo, and the Apache Ant project logos are trademarks of The Apache Software Foundation.</p> | |||
</div> | |||
</body> | |||
</html> |
@@ -18,7 +18,6 @@ | |||
<head> | |||
<meta http-equiv="Content-Language" content="en-us"> | |||
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> | |||
<title>Apache Ant User Manual - Credits</title> | |||
</head> | |||
@@ -44,9 +43,9 @@ | |||
<li>Bill Kelly (<a href="mailto:bill.kelly@softwired-inc.com">bill.kelly@softwired-inc.com</a>)</li> | |||
<li>Martijn Kruithof</li> | |||
<li>Arnout J. Kuiper (<a href="mailto:ajkuiper@wxs.nl">ajkuiper@wxs.nl</a>)</li> | |||
<li>Antoine Lévy-Lambert</li> | |||
<li>Antoine Lévy-Lambert</li> | |||
<li>Conor MacNeill</li> | |||
<li>Jan Matèrne</li> | |||
<li>Jan Matérne</li> | |||
<li>Stefano Mazzocchi (<a href="mailto:stefano@apache.org">stefano@apache.org</a>)</li> | |||
<li>Erik Meade (<a href="mailto:emeade@geekfarm.org">emeade@geekfarm.org</a>)</li> | |||
<li>Sam Ruby (<a href="mailto:rubys@us.ibm.com">rubys@us.ibm.com</a>)</li> | |||
@@ -65,6 +64,5 @@ | |||
<p>Version: 1.10.3</p> | |||
</center> | |||
</body> | |||
</html> |
@@ -25,13 +25,13 @@ | |||
<body> | |||
<h1>Developing with Apache Ant</h1> | |||
<h2><a name="writingowntask">Writing Your Own Task</a></h2> | |||
<h2 id="writingowntask">Writing Your Own Task</h2> | |||
<p>It is very easy to write your own task:</p> | |||
<ol> | |||
<li>Create a Java class that extends <code>org.apache.tools.ant.Task</code> | |||
or <a href="base_task_classes.html">another class</a> that was designed to be extended.</li> | |||
<li>For each attribute, write a <i>setter</i> method. The setter method must be a | |||
<li id="footnote-1-back">For each attribute, write a <i>setter</i> method. The setter method must be a | |||
<code>public void</code> method that takes a single argument. The | |||
name of the method must begin with <code>set</code>, followed by the | |||
attribute name, with the first character of the name in uppercase, and the rest in | |||
@@ -44,7 +44,7 @@ | |||
<a href="Tasks/parallel.html"><code>parallel</code></a>), your | |||
class must implement the interface | |||
<code>org.apache.tools.ant.TaskContainer</code>. If you do so, your | |||
task can not support any other nested elements. See | |||
task can not support any other nested elements. See | |||
<a href="#taskcontainer">below</a>.</li> | |||
<li>If the task should support character data (text nested between the | |||
@@ -61,7 +61,7 @@ | |||
takes a single argument of an <code>Object</code> type with a | |||
no-argument constructor. The name of the add (addConfigured) method | |||
must begin with <code>add</code> (<code>addConfigured</code>), | |||
followed by the element name. For a more complete discussion see | |||
followed by the element name. For a more complete discussion see | |||
<a href="#nested-elements">below</a>.</li> | |||
<li>Write a <code>public void execute</code> method, with no arguments, that | |||
@@ -70,7 +70,7 @@ | |||
</ol> | |||
<hr> | |||
<p><a name="footnote-1">*</a> Actually the case of the letters after | |||
<p id="footnote-1"><a href="#footnote-1-back">*</a> 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.</p> | |||
@@ -124,17 +124,17 @@ good convention, though.</p> | |||
have been created for <code>addConfiguredXXX()</code> methods, | |||
those methods get invoked now.</li> | |||
<li><a name="execute"><code>execute()</code></a> is called at runtime. | |||
<li id="execute"><code>execute()</code> is called at runtime. | |||
If <code>target1</code> and <code>target2</code> both depend | |||
on <code>target3</code>, then running | |||
<code>'ant target1 target2'</code> will run all tasks in | |||
<code>target3</code> twice.</li> | |||
</ol> | |||
<h3><a name="set-magic">Conversions Ant will perform for attributes</a></h3> | |||
<h3 id="set-magic">Conversions Ant will perform for attributes</h3> | |||
<p>Ant will always expand properties before it passes the value of an | |||
attribute to the corresponding setter method. <b>Since Ant 1.8</b>, it is | |||
attribute to the corresponding setter method. <em>Since Ant 1.8</em>, it is | |||
possible to <a href="Tasks/propertyhelper.html">extend Ant's property handling</a> | |||
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</p> | |||
<code>org.apache.tools.ant.types.Resource</code>, Ant will | |||
resolve the string as a <code>java.io.File</code> as above, then | |||
pass in as a <code>org.apache.tools.ant.types.resources.FileResource</code>. | |||
<b>Since Ant 1.8</b> | |||
<em>Since Ant 1.8</em> | |||
</li> | |||
<li><code>org.apache.tools.ant.types.Path</code>, Ant will tokenize | |||
@@ -205,7 +205,7 @@ is more! If the argument of you setter method is</p> | |||
<code>toString()</code> in the enumeration is ignored; the build file must use | |||
the declared name (see <code>Enum.getName()</code>). You may wish to use lowercase | |||
enum constant names, in contrast to usual Java style, to look better in build files. | |||
<em>As of Ant 1.7.0.</em></li> | |||
<em>Since Ant 1.7.0</em></li> | |||
</ul> | |||
@@ -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.</p> | |||
<h3><a name="nested-elements">Supporting nested elements</a></h3> | |||
<h3 id="nested-elements">Supporting nested elements</h3> | |||
<p>Let's assume your task shall support nested elements with the name | |||
<code>inner</code>. First of all, you need a class that represents | |||
@@ -261,7 +261,7 @@ handled.</p> | |||
the methods will be called, but we don't know which, this depends on | |||
the implementation of your Java virtual machine.</p> | |||
<h3><a name="nestedtype">Nested Types</a></h3> | |||
<h3 id="nestedtype">Nested Types</h3> | |||
If your task needs to nest an arbitrary type that has been defined | |||
using <code><typedef></code> you have two options. | |||
<ol> | |||
@@ -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: | |||
</p> | |||
<pre> | |||
<blockquote> | |||
<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> | |||
</blockquote> | |||
</pre> | |||
<h3><a name="taskcontainer">TaskContainer</a></h3> | |||
<h3 id="taskcontainer">TaskContainer</h3> | |||
<p>The <code>TaskContainer</code> consists of a single method, | |||
<code>addTask</code> that basically is the same as an <a | |||
@@ -466,10 +464,8 @@ implementing class name to the <code>default.properties</code> file in the | |||
<code>org.apache.tools.ant.taskdefs</code> | |||
package. Then you can use it as if it were a built-in task.</p> | |||
<hr> | |||
<h2><a name="buildevents">Build Events</a></h2> | |||
<h2 id="buildevents">Build Events</h2> | |||
<p>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</p> | |||
<li>Message logged</li> | |||
</ul> | |||
<p>If the build file invokes another build file via | |||
<a href="Tasks/ant.html"><code><ant></code></a> or | |||
<a href="Tasks/subant.html"><code><subant></code></a> or uses | |||
<p>If the build file invokes another build file via | |||
<a href="Tasks/ant.html"><code><ant></code></a> or | |||
<a href="Tasks/subant.html"><code><subant></code></a> or uses | |||
<a href="Tasks/antcall.html"><code><antcall></code></a>, 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. <em>Since Ant 1.6.2</em>, | |||
BuildListener interface has an extension named | |||
SubBuildListener that will receive two new events for</p> | |||
<ul> | |||
<li>SubBuild started</li> | |||
@@ -512,22 +508,18 @@ listener, of course).</p> | |||
<p>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.</p> | |||
<p><b>Note: </b>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 | |||
<p><b>Note</b>: 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.</p> | |||
<p><b>Note2:</b> All methods of a BuildListener except for the "Build | |||
<p><b>Note</b>: 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 <code><parallel></code> task.</p> | |||
<h3>Example</h3> | |||
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 { | |||
</pre> | |||
</blockquote> | |||
<hr> | |||
<h2><a name="integration">Source code integration</a></h2> | |||
<h2 id="integration">Source code integration</h2> | |||
<p>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.</p> | |||
<p>Please consult the | |||
<a href="http://www.apache.org/foundation/getinvolved.html">Getting Involved</a> pages on the Apache web site | |||
<a href="https://www.apache.org/foundation/getinvolved.html">Getting Involved</a> 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.</p> | |||
<p>Ant also has some | |||
<a href="http://ant.apache.org/ant_task_guidelines.html">task guidelines</a> | |||
<a href="https://ant.apache.org/ant_task_guidelines.html">task guidelines</a> | |||
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.</p> | |||
</body> | |||
</html> | |||
@@ -24,7 +24,7 @@ | |||
<body> | |||
<h2><a name="directorybasedtasks">Directory-based Tasks</a></h2> | |||
<h2 id="directorybasedtasks">Directory-based Tasks</h2> | |||
<p>Some tasks use directory trees for the actions they perform. | |||
For example, the <a href="Tasks/javac.html">javac</a> task, which | |||
compiles a directory tree with <code>.java</code> files into | |||
@@ -45,7 +45,7 @@ which can be used at the same time:</p> | |||
<li>Select files based on selection criteria defined by a collection of | |||
<a href="Types/selectors.html">selector</a> nested elements.</li> | |||
</ul> | |||
<h3><a name="patternset">Patternset</a></h3> | |||
<h3 id="patternset">Patternset</h3> | |||
<p>We said that Directory-based tasks can sometimes act as an implicit | |||
<a href="Types/fileset.html"><code><fileset></code></a>, | |||
@@ -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).</p> | |||
<h4><a name="patterns">Patterns</a></h4> | |||
<h4 id="patterns">Patterns</h4> | |||
<p>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.</p> | |||
<p><b>Examples:</b></p> | |||
<h5>Examples:</h5> | |||
<p> | |||
<code>*.java</code> matches <code>.java</code>, | |||
<code>x.java</code> and <code>FooBar.java</code>, but | |||
@@ -129,8 +129,8 @@ or <code>\</code>, then <code>**</code> | |||
is appended. | |||
For example, <code>mypackage/test/</code> is interpreted as if it were | |||
<code>mypackage/test/**</code>.</p> | |||
<p><b>Example patterns:</b></p> | |||
<table border="1" cellpadding="2" cellspacing="0"> | |||
<h5>Example patterns:</h5> | |||
<table> | |||
<tr> | |||
<td valign="top"><code>**/CVS/*</code></td> | |||
<td valign="top">Matches all files in <code>CVS</code> | |||
@@ -189,7 +189,7 @@ For example, <code>mypackage/test/</code> is interpreted as if it were | |||
<p>When these patterns are used in inclusion and exclusion, you have a powerful | |||
way to select just the files you want.</p> | |||
<h3><a name="selectors">Selectors</a></h3> | |||
<h3 id="selectors">Selectors</h3> | |||
<p>The <a href="Types/fileset.html"><code><fileset></code></a>, | |||
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 | |||
<a href="Types/selectors.html">Selector</a> documentation for more | |||
information.</p> | |||
<h3><a name="tasklist">Standard Tasks/Filesets</a></h3> | |||
<h3 id="tasklist">Standard Tasks/Filesets</h3> | |||
<p>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:</p> | |||
@@ -232,7 +232,7 @@ tasks that can act as an implicit fileset:</p> | |||
<li><a href="Tasks/wljspc.html"><code><wljspc></code></a></li> | |||
</ul> | |||
<h3><a name="examples">Examples</a></h3> | |||
<h3 id="examples">Examples</h3> | |||
<pre> | |||
<copy todir="${dist}"> | |||
<fileset dir="${src}" | |||
@@ -263,9 +263,9 @@ but excludes all <code>*.gif</code> files from the copy.</p> | |||
<p>Deleting the original set of files, the <code>delete</code> task can act | |||
as an implicit fileset.</p> | |||
<h3><a name="defaultexcludes">Default Excludes</a></h3> | |||
<h3 id="defaultexcludes">Default Excludes</h3> | |||
<p>There are a set of definitions that are excluded by default from all | |||
directory-based tasks. As of Ant 1.8.1 they are:</p> | |||
directory-based tasks. <em>Since Ant 1.8.1</em> they are:</p> | |||
<pre> | |||
**/*~ | |||
**/#*# | |||
@@ -282,7 +282,7 @@ directory-based tasks. As of Ant 1.8.1 they are:</p> | |||
**/.svn/** | |||
**/.DS_Store | |||
</pre> | |||
<p>Ant 1.8.2 adds the following default excludes:</p> | |||
<p><em>Since Ant 1.8.2</em>, additional default excludes are:</p> | |||
<pre> | |||
**/.git | |||
**/.git/** | |||
@@ -307,8 +307,5 @@ attribute.</p> | |||
default excludes by using the <a | |||
href="Tasks/defaultexcludes.html">defaultexcludes</a> task.</p> | |||
</body> | |||
</html> | |||
@@ -24,38 +24,38 @@ | |||
<body> | |||
<h1><a name="feedback">Feedback</a> and Troubleshooting</h1> | |||
<p>If things do not work, especially simple things like <tt>ant -version</tt>, | |||
then something is wrong with your configuration. Before filing bug reports and | |||
<h1 id="feedback">Feedback and Troubleshooting</h1> | |||
<p>If things do not work, especially simple things like <tt>ant -version</tt>, | |||
then something is wrong with your configuration. Before filing bug reports and | |||
emailing all the Apache Ant mailing lists</p> | |||
<ol> | |||
<li>Check your environment variables. Are ANT_HOME and JAVA_HOME correct? If | |||
<li>Check your environment variables. Are ANT_HOME and JAVA_HOME correct? If | |||
they have quotes or trailing slashes, remove them.</li> | |||
<li>Unset CLASSPATH; if that is wrong things go horribly wrong. Ant does not | |||
<li>Unset CLASSPATH; if that is wrong things go horribly wrong. Ant does not | |||
need the CLASSPATH variable defined to anything to work.</li> | |||
<li>Make sure there are no versions of crimson.jar or other XML parsers in JRE/ext</li> | |||
<li>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 | |||
<li>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.</li> | |||
<li>Which version of ant are you running? Other applications distribute a copy | |||
<li>Which version of ant are you running? Other applications distribute a copy | |||
-it may be being picked up by accident.</li> | |||
<li>If a task is failing to run is optional.jar in ANT_HOME/lib? Are there any | |||
<li>If a task is failing to run is optional.jar in ANT_HOME/lib? Are there any | |||
libraries which it depends on missing?</li> | |||
<li>If a task doesn't do what you expect, run <tt>ant -verbose</tt> or <tt>ant | |||
<li>If a task doesn't do what you expect, run <tt>ant -verbose</tt> or <tt>ant | |||
-debug</tt> to see what is happening</li> | |||
</ol> | |||
<p>If you can't fix your problem, start with the <a href="http://ant.apache.org/mail.html" target="_top">Ant | |||
User Mailing List</a> . 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 | |||
<p>If you can't fix your problem, start with the <a href="http://ant.apache.org/mail.html" target="_top">Ant | |||
User Mailing List</a> . 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. </p> | |||
<p>Also, if you don't understand something, the <a href="http://ant.apache.org/mail.html" target="_top">Ant | |||
User Mailing List</a> is the place to ask questions. Not the developer list, | |||
nor the individuals whose names appears in the source and documentation. If | |||
<p>Also, if you don't understand something, the <a href="http://ant.apache.org/mail.html" target="_top">Ant | |||
User Mailing List</a> 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. </p> | |||
<p>To provide feedback on this software, please subscribe to the <a href="http://ant.apache.org/mail.html" target="_top">Ant | |||
<p>To provide feedback on this software, please subscribe to the <a href="http://ant.apache.org/mail.html" target="_top">Ant | |||
User Mailing List</a> </p> | |||
<p>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</a>. | |||
Other archives will be documented online at <a href="http://ant.apache.org/mail.html#Archives" target="_top">Mailing Lists Archives</a> </p> | |||
</body> | |||
</html> | |||
@@ -99,7 +99,5 @@ All the modern Java IDEs support Apache Ant almost out of the box. | |||
</li> | |||
</ul> | |||
</body> | |||
</html> |
@@ -23,9 +23,9 @@ | |||
</head> | |||
<body> | |||
<h1><a name="if_and_unless">If And Unless</a></h1> | |||
<h1 id="if_and_unless">If And Unless</h1> | |||
<p>Since Ant 1.9.1 it is possible to add if and unless attributes on all tasks and nested elements using special namespaces.</p> | |||
<p><em>Since Ant 1.9.1</em>, it is possible to add if and unless attributes on all tasks and nested elements using special namespaces.</p> | |||
<p>In order to use this feature you need to add the following namespace declarations</p> | |||
<blockquote><pre> | |||
@@ -34,12 +34,12 @@ | |||
</pre> | |||
</blockquote> | |||
<p>The if and unless namespaces support the following 3 conditions : | |||
<p>The if and unless namespaces support the following 3 conditions:</p> | |||
<ul> | |||
<li>true</li>true if the value of the attribute evaluates to true | |||
<li>blank</li>true if the value of the attribute is null or empty | |||
<li>set</li>true if the specified property is set | |||
</ul></p> | |||
</ul> | |||
<blockquote> | |||
<pre> | |||
@@ -49,7 +49,7 @@ every Ant process, users can specify the implementation using the | |||
method</p> | |||
<pre> | |||
void handleInput(InputRequest request) | |||
void handleInput(InputRequest request) | |||
throws org.apache.tools.ant.BuildException; | |||
</pre> | |||
@@ -60,7 +60,7 @@ situation.</p> | |||
<p>Ant comes with three built-in implementations of this interface:</p> | |||
<h3><a name="defaulthandler">DefaultInputHandler</a></h3> | |||
<h3 id="defaulthandler">DefaultInputHandler</h3> | |||
<p>This is the implementation you get, when you don't use the | |||
<code>-inputhandler</code> command line switch at all. This | |||
@@ -92,13 +92,13 @@ define it inside the <code>ANT_OPTS</code> environment variable.</p> | |||
<p>Like the default implementation, this InputHandler reads from standard | |||
input. However, it consumes <i>all</i> available input. This behavior is | |||
useful for sending Ant input via an OS pipe. <b>Since Ant 1.7</b>.</p> | |||
useful for sending Ant input via an OS pipe. <em>Since Ant 1.7</em></p> | |||
<h3>SecureInputHandler</h3> | |||
<p>This InputHandler calls <code>System.console().readPassword()</code>, | |||
available since Java 1.6. On earlier platforms it falls back to the | |||
behavior of DefaultInputHandler. <b>Since Ant 1.7.1</b>.</p> | |||
behavior of DefaultInputHandler. <em>Since Ant 1.7.1</em></p> | |||
<h2>InputRequest</h2> | |||
@@ -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.</p> | |||
</body> | |||
</html> |
@@ -223,7 +223,7 @@ target="_top">http://archive.apache.org/dist/ant/</a>. 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. <em>Since Ant 1.7</em>, Windows 9x is no longer supported. | |||
</p> | |||
<p> | |||
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 | |||
<code>ANT_HOME</code>. | |||
</p> | |||
<table width="80%"> | |||
<tr> | |||
<td colspan="2"> | |||
<b>Windows 95, Windows 98 & Windows ME Note:</b> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td width="5%"> </td> | |||
<td> | |||
<h3>Windows 95, Windows 98 & Windows ME Note:</h3> | |||
<p> | |||
<i>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 <code>ANT_HOME</code> 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 <code>"for"</code> batch file statement. It is recommended, therefore, that Ant be installed in a | |||
<b>short</b>, 8.3 path, such as <code>C:\Ant</code>.</i> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td width="5%"> </td> | |||
<td> | |||
<p> | |||
</p> | |||
<p> | |||
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 | |||
<code>config.sys</code> file | |||
</p> | |||
<p> | |||
</p> | |||
<p> | |||
<code>shell=c:\command.com c:\ /p /e:32768</code> | |||
</p> | |||
</td> | |||
</tr> | |||
</table> | |||
</p> | |||
<h3 id="setup">Setup</h3> | |||
<p> | |||
@@ -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. | |||
</p> | |||
<table width="80%"> | |||
<tr> | |||
<td colspan="2"> | |||
<b>Windows Note:</b> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td width="5%"> </td> | |||
<td> | |||
<h3>Windows Note:</h3> | |||
<p> | |||
The <code>ant.bat</code> script makes use of three environment variables - <code>ANT_HOME</code>, | |||
<code>CLASSPATH</code> and <code>JAVA_HOME</code>. <b>Ensure</b> that <code>ANT_HOME</code> and | |||
<code>JAVA_HOME</code> variables are set, and that they do <b><u>not</u></b> have quotes (either ' or ") and | |||
they do <b><u>not</u></b> end with \ or with /. <code>CLASSPATH</code> should be unset or empty. | |||
</td> | |||
</tr> | |||
</table> | |||
</p> | |||
<h3 id="checkInstallation">Check Installation</h3> | |||
<p> | |||
@@ -398,7 +375,7 @@ In <code><i>ANT_HOME</i>/lib</code>. This makes the JAR files available to all A | |||
<li> | |||
<p> | |||
In <code>${user.home}/.ant/lib</code> (as of Ant 1.6). This allows different users to add new libraries to Ant. All JAR | |||
In <code>${user.home}/.ant/lib</code> (<em>since Ant 1.6</em>). This allows different users to add new libraries to Ant. All JAR | |||
files added to this directory are available to command-line Ant. | |||
</p> | |||
</li> | |||
@@ -418,7 +395,7 @@ applications, and causes no end of support calls. See <a href="#classpath">below | |||
<li> | |||
<p> | |||
In some <code><classpath></code> accepted by the task itself. For example, as of Ant 1.7.0 you can run | |||
In some <code><classpath></code> accepted by the task itself. <em>Since Ant 1.7.0</em>, you can run | |||
the <code><junit></code> task without <code>junit.jar</code> 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. | |||
</p> | |||
@@ -627,7 +604,7 @@ version, it is not necessary to set <code> JAVA_HOME</code> or <code>ANT_HOME</c | |||
installer will correctly place the Ant executable on your path. | |||
</p> | |||
<p> | |||
<b>NOTE:</b> <i>Since Ant 1.7.0</i>, if the <code>ANT_HOME</code> environment variable is set, the JPackage | |||
<b>Note</b>: <em>Since Ant 1.7.0</em>, if the <code>ANT_HOME</code> environment variable is set, the JPackage | |||
distribution will be ignored. | |||
</p> | |||
<p> | |||
@@ -716,7 +693,7 @@ on how to do this. | |||
</p> | |||
<p> | |||
As of version 1.7.0 Ant has a hard dependency on JUnit. The <code>fetch.xml</code> build script will download JUnit | |||
<em>Since Ant 1.7.0</em>, Ant has a hard dependency on JUnit. The <code>fetch.xml</code> build script will download JUnit | |||
automatically, but if you don't use this you must install it manually into <code>lib/optional</code> (download it | |||
from <a href="http://junit.org/" target="_top">JUnit.org</a>) if you are using a source distribution of Ant. | |||
</p> | |||
@@ -797,7 +774,7 @@ automatically). You will also need to install the particular Ant optional JAR co | |||
these tasks available. Please refer to the <a href="#optionalTasks"> Installing Ant / Optional Tasks</a> section above. | |||
</p> | |||
<table border="1" cellpadding="2" cellspacing="0"> | |||
<table> | |||
<tr> | |||
<td><b>JAR Name</b></td> | |||
<td><b>Needed For</b></td> | |||
@@ -41,4 +41,3 @@ | |||
</ul> | |||
</body> | |||
</html> | |||
@@ -23,7 +23,7 @@ | |||
</head> | |||
<body> | |||
<h1><a name="introduction">Introduction</a></h1> | |||
<h1 id="introduction">Introduction</h1> | |||
<p>Apache Ant is a Java-based build tool. In theory, it is kind of like | |||
<i>make</i>, without <i>make</i>'s wrinkles.</p> | |||
<h3>Why?</h3> | |||
@@ -54,7 +54,7 @@ tasks get executed. Each task is run by an object that implements a particular | |||
Task interface.</p> | |||
<p>Granted, this removes some of the expressive power that is inherent in being | |||
able to construct a shell command such as | |||
<nobr><code>`find . -name foo -exec rm {}`</code></nobr>, but it | |||
<code>`find . -name foo -exec rm {}`</code>, 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.</p> | |||
</body> | |||
</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.</p> | |||
<h2><a name="source">ant.build.javac.source</a></h2> | |||
<h2 id="source">ant.build.javac.source</h2> | |||
<p><em>Since Ant 1.7</em></p> | |||
<p>Provides a default value for <code><javac></code>'s and | |||
<code><javadoc></code>'s source attribute.</p> | |||
<h2><a name="target">ant.build.javac.target</a></h2> | |||
<h2 id="target">ant.build.javac.target</h2> | |||
<p><em>Since Ant 1.7</em></p> | |||
<p>Provides a default value for <code><javac></code>'s target | |||
attribute.</p> | |||
</body> | |||
</html> | |||
@@ -25,12 +25,12 @@ | |||
<body> | |||
<h1>Listeners & Loggers</h1> | |||
<h2><a name="Overview">Overview</a></h2> | |||
<h2 id="Overview">Overview</h2> | |||
<p>Apache Ant has two related features to allow the build process to be monitored: | |||
listeners and loggers.</p> | |||
<h3><a name="Listeners">Listeners</a></h3> | |||
<h3 id="Listeners">Listeners</h3> | |||
<p>A listener is alerted of the following events:</p> | |||
@@ -50,7 +50,7 @@ listeners and loggers.</p> | |||
argument. | |||
</p> | |||
<h3><a name="Loggers">Loggers</a></h3> | |||
<h3 id="Loggers">Loggers</h3> | |||
<p>Loggers extend the capabilities of listeners and add the following features:</p> | |||
@@ -61,228 +61,222 @@ listeners and loggers.</p> | |||
<li>Emacs-mode aware</li> | |||
</ul> | |||
<h2><a name="builtin">Built-in Listeners/Loggers</a></h2> | |||
<h2 id="builtin">Built-in Listeners/Loggers</h2> | |||
<table border="1" cellspacing="1" width="100%" id="AutoNumber1"> | |||
<table> | |||
<tr> | |||
<td width="33%">Classname</td> | |||
<td width="33%">Description</td> | |||
<td width="34%">Type</td> | |||
<td>Classname</td> | |||
<td>Description</td> | |||
<td>Type</td> | |||
</tr> | |||
<tr> | |||
<td width="33%"><code><a href="#DefaultLogger">org.apache.tools.ant.DefaultLogger</a></code></td> | |||
<td width="33%">The logger used implicitly unless overridden with the | |||
<td><code><a href="#DefaultLogger">org.apache.tools.ant.DefaultLogger</a></code></td> | |||
<td>The logger used implicitly unless overridden with the | |||
<code>-logger</code> command-line switch.</td> | |||
<td width="34%">BuildLogger</td> | |||
<td>BuildLogger</td> | |||
</tr> | |||
<tr> | |||
<td width="33%"><code><a href="#NoBannerLogger"> | |||
<td><code><a href="#NoBannerLogger"> | |||
org.apache.tools.ant.NoBannerLogger</a></code></td> | |||
<td width="33%">This logger omits output of empty target output.</td> | |||
<td width="34%">BuildLogger</td> | |||
<td>This logger omits output of empty target output.</td> | |||
<td>BuildLogger</td> | |||
</tr> | |||
<tr> | |||
<td width="33%"><code><a href="#MailLogger"> | |||
<td><code><a href="#MailLogger"> | |||
org.apache.tools.ant.listener.MailLogger</a></code></td> | |||
<td width="33%">Extends DefaultLogger such that output is still generated | |||
<td>Extends DefaultLogger such that output is still generated | |||
the same, and when the build is finished an e-mail can be sent.</td> | |||
<td width="34%">BuildLogger</td> | |||
<td>BuildLogger</td> | |||
</tr> | |||
<tr> | |||
<td width="33%"><code><a href="#AnsiColorLogger"> | |||
<td><code><a href="#AnsiColorLogger"> | |||
org.apache.tools.ant.listener.AnsiColorLogger</a></code></td> | |||
<td width="33%">Colorifies the build output.</td> | |||
<td width="34%">BuildLogger</td> | |||
<td>Colorifies the build output.</td> | |||
<td>BuildLogger</td> | |||
</tr> | |||
<tr> | |||
<td width="33%"><code><a href="#Log4jListener"> | |||
<td><code><a href="#Log4jListener"> | |||
org.apache.tools.ant.listener.Log4jListener</a></code></td> | |||
<td width="33%"> | |||
<td> | |||
Passes events to Apache Log4j for highly customizable logging.<br> | |||
<b>Deprecated:</b> Apache Log4j (1.x) is not developed any more. Last | |||
release is 1.2.17 from 26-May-2012 and contains vulnerability issues. | |||
</td> | |||
<td width="34%">BuildListener</td> | |||
<td>BuildListener</td> | |||
</tr> | |||
<tr> | |||
<td width="33%"><code><a href="#XmlLogger">org.apache.tools.ant.XmlLogger</a></code></td> | |||
<td width="33%">Writes the build information to an XML file.</td> | |||
<td width="34%">BuildLogger</td> | |||
<td><code><a href="#XmlLogger">org.apache.tools.ant.XmlLogger</a></code></td> | |||
<td>Writes the build information to an XML file.</td> | |||
<td>BuildLogger</td> | |||
</tr> | |||
<tr> | |||
<td width="33%"><code><a href="#TimestampedLogger">org.apache.tools.ant.TimestampedLogger</a></code></td> | |||
<td width="33%">Prints the time that a build finished</td> | |||
<td width="34%">BuildLogger</td> | |||
<td><code><a href="#TimestampedLogger">org.apache.tools.ant.TimestampedLogger</a></code></td> | |||
<td>Prints the time that a build finished</td> | |||
<td>BuildLogger</td> | |||
</tr> | |||
<tr> | |||
<td width="33%"><code><a href="#BigProjectLogger">org.apache.tools.ant.listener.BigProjectLogger</a></code></td> | |||
<td width="33%">Prints the project name every target</td> | |||
<td width="34%">BuildLogger</td> | |||
<td><code><a href="#BigProjectLogger">org.apache.tools.ant.listener.BigProjectLogger</a></code></td> | |||
<td>Prints the project name every target</td> | |||
<td>BuildLogger</td> | |||
</tr> | |||
<tr> | |||
<td width="33%"><code><a href="#SimpleBigProjectLogger">org.apache.tools.ant.listener.SimpleBigProjectLogger</a></code></td> | |||
<td width="33%">Prints the project name for subprojects only, otherwise like NoBannerLogger <em>Since Ant 1.8.1</em></td> | |||
<td width="34%">BuildLogger</td> | |||
<td><code><a href="#SimpleBigProjectLogger">org.apache.tools.ant.listener.SimpleBigProjectLogger</a></code></td> | |||
<td>Prints the project name for subprojects only, otherwise like NoBannerLogger <em>Since Ant 1.8.1</em></td> | |||
<td>BuildLogger</td> | |||
</tr> | |||
<tr> | |||
<td width="33%"><code><a href="#ProfileLogger">org.apache.tools.ant.listener.ProfileLogger</a></code></td> | |||
<td width="33%">The default logger, with start times, end times and | |||
<td><code><a href="#ProfileLogger">org.apache.tools.ant.listener.ProfileLogger</a></code></td> | |||
<td>The default logger, with start times, end times and | |||
durations added for each task and target.</td> | |||
<td width="34%">BuildLogger</td> | |||
<td>BuildLogger</td> | |||
</tr> | |||
</table> | |||
<h3><a name="DefaultLogger">DefaultLogger</a></h3> | |||
<h3 id="DefaultLogger">DefaultLogger</h3> | |||
<p>Simply run Ant normally, or:</p> | |||
<blockquote> | |||
<p><code>ant -logger org.apache.tools.ant.DefaultLogger</code></p> | |||
</blockquote> | |||
<h3><a name="NoBannerLogger">NoBannerLogger</a></h3> | |||
<h3 id="NoBannerLogger">NoBannerLogger</h3> | |||
<p>Removes output of empty target output.</p> | |||
<blockquote> | |||
<p><code>ant -logger org.apache.tools.ant.NoBannerLogger</code></p> | |||
</blockquote> | |||
<h3><a name="MailLogger">MailLogger</a></h3> | |||
<h3 id="MailLogger">MailLogger</h3> | |||
<p>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.</p> | |||
<p>Properties controlling the operation of MailLogger:</p> | |||
<table border="1" cellspacing="1" width="100%" id="AutoNumber2"> | |||
<table> | |||
<tr> | |||
<th width="337">Property</th> | |||
<th width="63%">Description</th> | |||
<th width="63%">Required</th> | |||
<th>Property</th> | |||
<th>Description</th> | |||
<th>Required</th> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.mailhost </td> | |||
<td width="63%">Mail server to use</td> | |||
<td width="63%">No, default "localhost"</td> | |||
<td>MailLogger.mailhost </td> | |||
<td>Mail server to use</td> | |||
<td>No, default "localhost"</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.port </td> | |||
<td width="63%">SMTP Port for the Mail server</td> | |||
<td width="63%">No, default "25"</td> | |||
<td>MailLogger.port </td> | |||
<td>SMTP Port for the Mail server</td> | |||
<td>No, default "25"</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.user</td> | |||
<td width="63%">user name for SMTP auth</td> | |||
<td width="63%">Yes, if SMTP auth is required on your SMTP server<br> | |||
<td>MailLogger.user</td> | |||
<td>user name for SMTP auth</td> | |||
<td>Yes, if SMTP auth is required on your SMTP server<br> | |||
the email message will be then sent using Mime and requires JavaMail</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.password</td> | |||
<td width="63%">password for SMTP auth</td> | |||
<td width="63%">Yes, if SMTP auth is required on your SMTP server<br> | |||
<td>MailLogger.password</td> | |||
<td>password for SMTP auth</td> | |||
<td>Yes, if SMTP auth is required on your SMTP server<br> | |||
the email message will be then sent using Mime and requires JavaMail</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.ssl</td> | |||
<td width="63%">on or true if ssl is needed<br> | |||
<td>MailLogger.ssl</td> | |||
<td>on or true if ssl is needed<br> | |||
This feature requires JavaMail</td> | |||
<td width="63%"> | |||
<td> | |||
no</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.from</td> | |||
<td width="63%">Mail "from" address</td> | |||
<td width="63%">Yes, if mail needs to be sent</td> | |||
<td>MailLogger.from</td> | |||
<td>Mail "from" address</td> | |||
<td>Yes, if mail needs to be sent</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.replyto</td> | |||
<td width="63%">Mail "replyto" address(es), comma-separated</td> | |||
<td width="63%">No</td> | |||
<td>MailLogger.replyto</td> | |||
<td>Mail "replyto" address(es), comma-separated</td> | |||
<td>No</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.failure.notify </td> | |||
<td width="63%">Send build failure e-mails?</td> | |||
<td width="63%">No, default "true"</td> | |||
<td>MailLogger.failure.notify </td> | |||
<td>Send build failure e-mails?</td> | |||
<td>No, default "true"</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.success.notify </td> | |||
<td width="63%">Send build success e-mails?</td> | |||
<td width="63%">No, default "true"</td> | |||
<td>MailLogger.success.notify </td> | |||
<td>Send build success e-mails?</td> | |||
<td>No, default "true"</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.failure.to </td> | |||
<td width="63%">Address(es) to send failure messages to, comma-separated</td> | |||
<td width="63%">Yes, if failure mail is to be sent</td> | |||
<td>MailLogger.failure.to </td> | |||
<td>Address(es) to send failure messages to, comma-separated</td> | |||
<td>Yes, if failure mail is to be sent</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.success.to </td> | |||
<td width="63%">Address(es) to send success messages to, comma-separated</td> | |||
<td width="63%">Yes, if success mail is to be sent</td> | |||
<td>MailLogger.success.to </td> | |||
<td>Address(es) to send success messages to, comma-separated</td> | |||
<td>Yes, if success mail is to be sent</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.failure.cc </td> | |||
<td width="63%">Address(es) to send failure messages to carbon copy (cc), comma-separated</td> | |||
<td width="63%">No</td> | |||
<td>MailLogger.failure.cc </td> | |||
<td>Address(es) to send failure messages to carbon copy (cc), comma-separated</td> | |||
<td>No</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.success.cc </td> | |||
<td width="63%">Address(es) to send success messages to carbon copy (cc), comma-separated</td> | |||
<td width="63%">No</td> | |||
<td>MailLogger.success.cc </td> | |||
<td>Address(es) to send success messages to carbon copy (cc), comma-separated</td> | |||
<td>No</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.failure.bcc </td> | |||
<td width="63%">Address(es) to send failure messages to blind carbon copy (bcc), comma-separated</td> | |||
<td width="63%">No</td> | |||
<td>MailLogger.failure.bcc </td> | |||
<td>Address(es) to send failure messages to blind carbon copy (bcc), comma-separated</td> | |||
<td>No</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.success.bcc </td> | |||
<td width="63%">Address(es) to send success messages to blind carbon copy (bcc), comma-separated</td> | |||
<td width="63%">No</td> | |||
<td>MailLogger.success.bcc </td> | |||
<td>Address(es) to send success messages to blind carbon copy (bcc), comma-separated</td> | |||
<td>No</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.failure.subject </td> | |||
<td width="63%">Subject of failed build</td> | |||
<td width="63%">No, default "Build Failure"</td> | |||
<td>MailLogger.failure.subject </td> | |||
<td>Subject of failed build</td> | |||
<td>No, default "Build Failure"</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.success.subject </td> | |||
<td width="63%">Subject of successful build</td> | |||
<td width="63%">No, default "Build Success"</td> | |||
<td>MailLogger.success.subject </td> | |||
<td>Subject of successful build</td> | |||
<td>No, default "Build Success"</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.failure.body</td> | |||
<td width="63%">Fixed body of the email for a failed | |||
<td>MailLogger.failure.body</td> | |||
<td>Fixed body of the email for a failed | |||
build. <em>Since Ant 1.8.0</em></td> | |||
<td width="63%">No, default is to send the full log output.</td> | |||
<td>No, default is to send the full log output.</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.success.body</td> | |||
<td width="63%">Fixed body of the email for a successful | |||
<td>MailLogger.success.body</td> | |||
<td>Fixed body of the email for a successful | |||
build. <em>Since Ant 1.8.0</em></td> | |||
<td width="63%">No, default is to send the full log output.</td> | |||
<td>No, default is to send the full log output.</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.mimeType</td> | |||
<td width="63%">MIME-Type of the message. <em>Since Ant 1.8.0</em></td> | |||
<td width="63%">No, default is text/plain</td> | |||
<td>MailLogger.mimeType</td> | |||
<td>MIME-Type of the message. <em>Since Ant 1.8.0</em></td> | |||
<td>No, default is text/plain</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.charset</td> | |||
<td width="63%">Character set of the message. <em>Since Ant 1.8.0</em></td> | |||
<td width="63%">No</td> | |||
<td>MailLogger.charset</td> | |||
<td>Character set of the message. <em>Since Ant 1.8.0</em></td> | |||
<td>No</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.starttls.enable</td> | |||
<td width="63%">on or true if STARTTLS should be supported | |||
<td>MailLogger.starttls.enable</td> | |||
<td>on or true if STARTTLS should be supported | |||
(requires JavaMail). <em>Since Ant 1.8.0</em></td> | |||
<td width="63%">No, default is false</td> | |||
<td>No, default is false</td> | |||
</tr> | |||
<tr> | |||
<td width="337">MailLogger.properties.file </td> | |||
<td width="63%">Filename of properties file that will override other values.</td> | |||
<td width="63%">No</td> | |||
<td>MailLogger.properties.file </td> | |||
<td>Filename of properties file that will override other values.</td> | |||
<td>No</td> | |||
</tr> | |||
</table> | |||
@@ -290,9 +284,7 @@ control for turning off success or failure messages individually.</p> | |||
<p><code>ant -logger org.apache.tools.ant.listener.MailLogger</code></p> | |||
</blockquote> | |||
<h3><a name="AnsiColorLogger">AnsiColorLogger</a></h3> | |||
<h3 id="AnsiColorLogger">AnsiColorLogger</h3> | |||
<p>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.</p> | |||
<p>This is designed to work on terminals that support ANSI | |||
color codes. It works on XTerm, ETerm, Win9x Console | |||
(with ANSI.SYS loaded.), etc.</p> | |||
<p><Strong>NOTE:</Strong> | |||
<p><strong>NOTE:</strong> | |||
It doesn't work on WinNT and successors, even when a COMMAND.COM console loaded with | |||
ANSI.SYS is used.</p> | |||
<p>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:</p><code><pre> | |||
and their default values are shown below:</p><pre> | |||
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</pre></code> | |||
AnsiColorLogger.DEBUG_COLOR=2;34</pre> | |||
<p>Each key takes as value a color combination defined as | |||
<b>Attribute;Foreground;Background</b>. In the above example, background | |||
value has not been used.</p> | |||
@@ -362,12 +354,10 @@ Background is one of the following: | |||
47 -> White</pre> | |||
<blockquote> | |||
<p><code>ant -logger org.apache.tools.ant.listener.AnsiColorLogger</code></p> | |||
<pre>ant -logger org.apache.tools.ant.listener.AnsiColorLogger</pre> | |||
</blockquote> | |||
<h3><a name="Log4jListener">Log4jListener</a></h3> | |||
<h3 id="Log4jListener">Log4jListener</h3> | |||
<p><b>Deprecated:</b> Apache Log4j (1) is not developed any more. Last | |||
release is 1.2.17 from 26-May-2012 and contains vulnerability issues.</p> | |||
<p>Passes build events to Log4j, using the full classname's of the generator of | |||
@@ -379,13 +369,13 @@ each build event as the category:</p> | |||
<li>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.</li> | |||
</ul> | |||
<p>All start events are logged as INFO. Finish events are either logged as | |||
<p>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.</p> | |||
<blockquote> | |||
<p><code>ant -listener org.apache.tools.ant.listener.Log4jListener</code></p> | |||
<pre>ant -listener org.apache.tools.ant.listener.Log4jListener</pre> | |||
</blockquote> | |||
<p>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 <i>-lib</i> option:</p> | |||
<blockquote> | |||
<pre><code>ant -listener org.apache.tools.ant.listener.Log4jListener -lib .</code></pre> | |||
<pre>ant -listener org.apache.tools.ant.listener.Log4jListener -lib .</pre> | |||
</blockquote> | |||
<p>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:</p> | |||
<blockquote> | |||
<pre><code>log4j.rootLogger=ERROR, LogFile | |||
<pre>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 | |||
</code></pre> | |||
</pre> | |||
</blockquote> | |||
<p>For more information about configuring Log4J see <a href="http://logging.apache.org/log4j/docs/documentation.html">its | |||
@@ -432,7 +422,7 @@ to your classpath (e.g. via the <code>-lib</code> 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 | |||
<blockquote> | |||
<pre><code><?xml version="1.0" encoding="UTF-8"?> | |||
<pre><?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> | |||
</code></pre> | |||
</pre> | |||
</blockquote> | |||
<h3><a name="XmlLogger">XmlLogger</a></h3> | |||
<h3 id="XmlLogger">XmlLogger</h3> | |||
<p>Writes all build information out to an XML file named log.xml, or the value | |||
of the <code>XmlLogger.file</code> 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.</p> | |||
<blockquote> | |||
<p><code>ant -listener org.apache.tools.ant.XmlLogger</code><br> | |||
<code>ant -logger org.apache.tools.ant.XmlLogger -verbose -logfile build_log.xml</code></p> | |||
<pre>ant -listener org.apache.tools.ant.XmlLogger | |||
ant -logger org.apache.tools.ant.XmlLogger -verbose -logfile build_log.xml</pre> | |||
</blockquote> | |||
<h3><a name="TimestampedLogger">TimestampedLogger</a></h3> | |||
<h3 id="TimestampedLogger">TimestampedLogger</h3> | |||
<p> | |||
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.</p> | |||
<p>To use this listener, use the command:</p> | |||
<blockquote> | |||
<code>ant -logger org.apache.tools.ant.listener.TimestampedLogger</code> | |||
<pre>ant -logger org.apache.tools.ant.listener.TimestampedLogger</pre> | |||
</blockquote> | |||
<h3><a name="BigProjectLogger">BigProjectLogger</a></h3> | |||
<h3 id="BigProjectLogger">BigProjectLogger</h3> | |||
<p> | |||
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" | |||
</p> | |||
<p>To use this listener, use the command:</p> | |||
<blockquote> | |||
<code>ant -logger org.apache.tools.ant.listener.BigProjectLogger</code> | |||
<pre>ant -logger org.apache.tools.ant.listener.BigProjectLogger</pre> | |||
</blockquote> | |||
<h3><a name="SimpleBigProjectLogger">SimpleBigProjectLogger</a></h3> | |||
<h3 id="SimpleBigProjectLogger">SimpleBigProjectLogger</h3> | |||
<p>Like <code>BigProjectLogger</code>, project-qualified target names are printed, | |||
useful for big builds with subprojects. | |||
Otherwise it is as quiet as <code>NoBannerLogger</code>:</p> | |||
@@ -572,18 +556,18 @@ Building jar: /sources/myapp/build/myapp.jar | |||
BUILD SUCCESSFUL | |||
Total time: 1 second | |||
</pre> | |||
<p><b>since Ant 1.8.1</b></p> | |||
<p><em>since Ant 1.8.1</em></p> | |||
<p>To use this listener, use the command:</p> | |||
<blockquote> | |||
<code>ant -logger org.apache.tools.ant.listener.SimpleBigProjectLogger</code> | |||
<pre>ant -logger org.apache.tools.ant.listener.SimpleBigProjectLogger</pre> | |||
</blockquote> | |||
<h3><a name="ProfileLogger">ProfileLogger</a></h3> | |||
<h3 id="ProfileLogger">ProfileLogger</h3> | |||
<p>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. | |||
</p> | |||
<!-- This is the 'since' as described in the Loggers JavaDoc --> | |||
<p><b>since Ant 1.8.0</b></p> | |||
<p><em>since Ant 1.8.0</em></p> | |||
<h4>Example</h4> | |||
Having that buildfile | |||
<pre> | |||
@@ -630,9 +614,7 @@ BUILD SUCCESSFUL | |||
Total time: 2 seconds | |||
</pre> | |||
<h2><a name="dev">Writing your own</a></h2> | |||
<h2 id="dev">Writing your own</h2> | |||
<p>See the <a href="develop.html#buildevents">Build Events</a> section for | |||
developers.</p> | |||
@@ -15,12 +15,12 @@ | |||
limitations under the License. | |||
--> | |||
<html> | |||
<head> | |||
<meta http-equiv="Content-Language" content="en-us"> | |||
<link rel="stylesheet" type="text/css" href="stylesheets/style.css"> | |||
<title>Platform Issues</title> | |||
</head> | |||
<body> | |||
<h1>Platform Issues</h1> | |||
@@ -34,13 +34,13 @@ for example) may not work against the shipping XSL engine. | |||
<h2>Unix and Linux</h2> | |||
<ul> | |||
<li> You should use a GNU version of <tt>tar</tt> to untar the Apache | |||
<li> You should use a GNU version of <tt>tar</tt> 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. | |||
</li> | |||
<li> Ant does not preserve file permissions when a file is copied, moved or | |||
<li> 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 <tt><chmod></tt> to set permissions, and when creating a | |||
Use <tt><chmod></tt> to set permissions, and when creating a | |||
tar archive, use the <tt>mode</tt> attribute of <tt><tarfileset></tt> | |||
to set the permissions in the tar file, or <code><apply></code> the real tar program. | |||
</li> | |||
@@ -50,12 +50,10 @@ of directories to build up a list of files. Unexpected things can happen. | |||
<li> 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. | |||
</li> | |||
</ul> | |||
<h2>Microsoft Windows</h2> | |||
<p> | |||
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, | |||
<p> | |||
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. | |||
</p> | |||
<p> | |||
Customers who upgrade to Linux report improved security, richer | |||
functionality, and increased productivity. | |||
functionality, and increased productivity. | |||
</p> | |||
<h2>Microsoft Windows 2K, XP and Server 2K03 </h2> | |||
<p> | |||
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. | |||
</p> | |||
<p> | |||
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. | |||
</p> | |||
<p> | |||
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. | |||
</p> | |||
<h2>Microsoft Windows Vista</h2> | |||
<p> | |||
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. | |||
</p> | |||
<h2>Cygwin</h2> | |||
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 : | |||
<a href="http://www.inonit.com/cygwin/faq/">http://www.inonit.com/cygwin/faq/</a> . | |||
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 | |||
<p> | |||
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 : | |||
<a href="http://www.inonit.com/cygwin/faq/">http://www.inonit.com/cygwin/faq/</a> . | |||
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:\. | |||
</p> | |||
<p> | |||
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 <code><exec></code> task in ant to convert cygwin paths to Windows path, for | |||
instance like that : | |||
You can use the <code><exec></code> task in ant to convert cygwin paths to Windows path, for | |||
instance like that: | |||
</p> | |||
<pre> | |||
<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}"/> | |||
</pre> | |||
<p> | |||
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. | |||
</p> | |||
<h2>Apple MacOS X</h2> | |||
<p> | |||
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. | |||
</p> | |||
<h2>Novell Netware</h2> | |||
<p>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).</p> | |||
<p>One important item of note is that you need to set up the following to run ant:</p> | |||
<p>One important item of note is that you need to set up the following to run Ant:</p> | |||
<ul><li><code>CLASSPATH</code> - put ant.jar and any other needed jars on the system classpath.</li> | |||
<li><code>ANT_OPTS</code> - On NetWare, <code>ANT_OPTS</code> needs to include a parameter of the form, <nobr>"-envCWD=<code>ANT_HOME</code>"</nobr>, with <code>ANT_HOME</code> being the fully expanded location of Ant, <b>not</b> an environment variable. This is due to the fact that the NetWare System Console has no notion of a current working directory.</li> | |||
<li><code>ANT_OPTS</code> - On NetWare, <code>ANT_OPTS</code> needs to include a parameter of the form, "<code>-envCWD=<i>ANT_HOME</i></code>", with <code><i>ANT_HOME</i></code> being the fully expanded location of Ant, <b>not</b> an environment variable. This is due to the fact that the NetWare System Console has no notion of a current working directory.</li> | |||
</ul> | |||
<p>It is suggested that you create up an ant.ncf that sets up these parameters, and calls <code>perl ANT_HOME/dist/bin/runant.pl</code></p> | |||
<p>The following is an example of such an NCF file(assuming ant is installed in <nobr>'sys:/apache-ant/'):</nobr></p> | |||
<code> | |||
envset CLASSPATH=SYS:/apache-ant/bootstrap/lib/ant.jar<br> | |||
envset CLASSPATH=$CLASSPATH;SYS:/apache-ant/lib/optional/junit.jar <br> | |||
envset CLASSPATH=$CLASSPATH;SYS:/apache-ant/bootstrap/lib/optional.jar <br> | |||
<br> | |||
setenv ANT_OPTS=-envCWD=sys:/apache-ant <br> | |||
envset ANT_OPTS=-envCWD=sys:/apache-ant <br> | |||
setenv ANT_HOME=sys:/apache-ant/dist/lib <br> | |||
envset ANT_HOME=sys:/apache-ant/dist/lib <br> | |||
<br> | |||
perl sys:/apache-ant/dist/bin/runant.pl <br> | |||
</code> | |||
<p>The following is an example of such an NCF file (assuming Ant is installed in <code>'sys:/apache-ant/'</code>):</p> | |||
<pre> | |||
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 | |||
</pre> | |||
<p>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.</p> | |||
<p>JVM 1.3 is supported on Novell NetWare versions 5.1 and higher.</p> | |||
<h2>Other platforms</h2> | |||
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. | |||
</body> | |||
</html> |
@@ -25,7 +25,7 @@ | |||
<body> | |||
<h1>The Apache Ant frontend: ProjectHelper</h1> | |||
<h2><a name="definition">What is a ProjectHelper?</a></h2> | |||
<h2 id="definition">What is a ProjectHelper?</h2> | |||
<p> | |||
The <code>ProjectHelper</code> 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. | |||
</p> | |||
<h2><a name="repository">How is Ant is selecting the proper ProjectHelper</a></h2> | |||
<h2 id="repository">How is Ant is selecting the proper ProjectHelper</h2> | |||
<p> | |||
Ant knows about several implementations of <code>ProjectHelper</code> | |||
@@ -61,7 +61,7 @@ and has to decide which to use for each build file. | |||
</p> | |||
<p>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':</p> | |||
<ul> | |||
<li>the first to be searched for is the one declared by the system property | |||
<code>org.apache.tools.ant.ProjectHelper</code> (see | |||
@@ -76,7 +76,7 @@ in the same order they've been found in an internal 'repository': | |||
<li>last but not least it will add its default <code>ProjectHelper</code> | |||
that can parse classical build.xml files.</li> | |||
</ul> | |||
In case of an error while trying to instantiate a <code>ProjectHelper</code>, Ant | |||
<p>In case of an error while trying to instantiate a <code>ProjectHelper</code>, Ant | |||
will log an error but won't stop. If you want further debugging | |||
info about the <code>ProjectHelper</code> internal 'repository', use the <b>system</b> | |||
property <code>ant.project-helper-repo.debug</code> and set it to | |||
@@ -97,7 +97,7 @@ a default input file. It will iterate over list of <code>ProjectHelper</code>s | |||
and will select the first one that expects a default file that actually exist. | |||
</p> | |||
<h2><a name="writing">Writing your own ProjectHelper</a></h2> | |||
<h2 id="writing">Writing your own ProjectHelper</h2> | |||
<p> | |||
The class <code>org.apache.tools.ant.ProjectHelper</code> is the API expected to | |||
@@ -111,6 +111,7 @@ constructor with no arguments. | |||
<p> | |||
There are some functions that will help you define what your helper is | |||
capable of and what is is expecting: | |||
</p> | |||
<ul> | |||
<li><code>getDefaultBuildFile()</code>: defines which file name is expected if | |||
none provided</li> | |||
@@ -125,11 +126,11 @@ capable of and what is is expecting: | |||
descriptor if your implementation returned <code>true</code> | |||
for the previous method.</li> | |||
</ul> | |||
</p> | |||
<p> | |||
Now that you have your implementation ready, you have to declare it to Ant. Three | |||
solutions here: | |||
</p> | |||
<ul> | |||
<li>use the system property <code>org.apache.tools.ant.ProjectHelper</code> | |||
(see also the <a href="running.html#sysprops">Java System Properties</a>);</li> | |||
@@ -143,8 +144,6 @@ solutions here: | |||
'repository'. Then your helper can be used on the next call to the | |||
<a href="Tasks/import.html">import</a> task.</li> | |||
</ul> | |||
</p> | |||
</body> | |||
</html> | |||
@@ -43,14 +43,14 @@ | |||
the <a href="Tasks/ant.html">ant</a>, antcall or subant tasks | |||
and make it available to the calling build process, though.</p> | |||
<p>Starting with Ant 1.8.0 | |||
<p><em>Since Ant 1.8.0</em> | |||
the <a href="Tasks/local.html">local</a> task can be used to | |||
create properties that are locally scoped to a target or | |||
a <a href="Tasks/sequential.html">sequential</a> element like | |||
the one of the <a href="Tasks/macrodef.html">macrodef</a> | |||
task.</p> | |||
<h2><a name="built-in-props">Built-in Properties</a></h2> | |||
<h2 id="built-in-props">Built-in Properties</h2> | |||
<p>Ant provides access to all system properties as if they had been | |||
defined using a <code><property></code> 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. | |||
</pre> | |||
<h1><a name="propertyHelper">PropertyHelpers</a></h1> | |||
<h1 id="propertyHelper">PropertyHelpers</h1> | |||
<p>Ant's property handling is accomplished by an instance of | |||
<code>org.apache.tools.ant.PropertyHelper</code> associated with | |||
@@ -210,7 +210,6 @@ public class ToStringEvaluator implements PropertyHelper.PropertyEvaluator { | |||
} | |||
</pre> | |||
<h1>Property Expansion</h1> | |||
<p>When Ant encounters a construct <code>${some-text}</code> the | |||
@@ -238,7 +237,7 @@ public class ToStringEvaluator implements PropertyHelper.PropertyEvaluator { | |||
<p>if the property <code>builddir</code> has the | |||
value <code>build/classes</code>.</p> | |||
<p>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</a> provides a few interesting evaluators but there are | |||
also a few built-in ones.</p> | |||
<h3><a name="toString">Getting the value of a Reference with | |||
${toString:}</a></h3> | |||
<h3 id="toString">Getting the value of a Reference with | |||
${toString:}</h3> | |||
<p>Any Ant type which has been declared with a reference can also | |||
its string value extracted by using the <code>${toString:}</code> | |||
@@ -305,8 +304,8 @@ public class ToStringEvaluator implements PropertyHelper.PropertyEvaluator { | |||
<p>There is no guarantee that external types provide meaningful | |||
information in such a situation</p> | |||
<h3><a name="ant.refid">Getting the value of a Reference with | |||
${ant.refid:}</a></h3> | |||
<h3 id="ant.refid">Getting the value of a Reference with | |||
${ant.refid:}</h3> | |||
<p>Any Ant type which has been declared with a reference can also be | |||
used as a property by using the <code>${ant.refid:}</code> | |||
@@ -332,7 +331,7 @@ public void setAttr(Resource r) { ... } | |||
<my:task attr="${ant.refid:anturl}"/> | |||
</pre> | |||
<h2><a name="if+unless">If/Unless Attributes</a></h2> | |||
<h2 id="if+unless">If/Unless Attributes</h2> | |||
<p> | |||
The <code><target></code> element and various tasks (such as | |||
<code><fail></code>) and task elements (such as <code><test></code> | |||
@@ -357,7 +356,7 @@ public void setAttr(Resource r) { ... } | |||
<target name="lots-of-stuff" depends="use-file,other-unconditional-stuff"/> | |||
</pre> | |||
<p> | |||
As of Ant 1.8.0, you may instead use property expansion; a value of | |||
<em>Since Ant 1.8.0</em>, you may instead use property expansion; a value of | |||
<tt>true</tt> (or <tt>on</tt> or <tt>yes</tt>) will enable the | |||
item, while <tt>false</tt> (or <tt>off</tt> or <tt>no</tt>) will | |||
disable it. Other values are still assumed to be property | |||
@@ -402,3 +401,4 @@ public void setAttr(Resource r) { ... } | |||
</pre> | |||
</body> | |||
</html> |
@@ -31,7 +31,6 @@ Consult your IDE documentation for IDE-specific information upon proxy setup. | |||
</p> | |||
<p> | |||
All tasks and threads running in Ant's JVM share the same HTTP/FTP/Socks | |||
proxy configuration. | |||
</p> | |||
@@ -56,13 +55,11 @@ proxy configuration. | |||
</p> | |||
<h3>Java1.5+ proxy support (new for Ant1.7)</h3> | |||
<h3>Java1.5+ proxy support (<em>since Ant 1.7</em>)</h3> | |||
<p> | |||
When Ant starts up, if the <code>-autoproxy</code> | |||
command is supplied, Ant sets the | |||
<code>java.net.useSystemProxies</code> system property. This tells | |||
<code>java.net.useSystemProxies</code> 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 <code>java.net.useSystemProxies</code> is checked only | |||
once, at startup time, the other checks (registry, gconf, system properties) are done | |||
dynamically whenever needed (socket connection, URL connection etc..). | |||
</p> | |||
<h5>Windows</h5> | |||
<h5>Windows</h5> | |||
<p> | |||
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. | |||
</p> | |||
<h5>Linux</h5> | |||
<p> | |||
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 | |||
<code>gconf-editor</code> tool to add these entries. | |||
</p> | |||
<h3>Manual JVM options</h3> | |||
<p> | |||
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 | |||
</p> | |||
<p> | |||
For bash: | |||
</p> | |||
</p> | |||
<pre> | |||
export ANT_OPTS="-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080" | |||
</pre> | |||
@@ -153,30 +148,29 @@ by all continuous integration tools running on the system that call Ant via the | |||
command line. | |||
</p> | |||
<p> | |||
For Windows, set the <code>ANT_OPTS</code> environment variable in the appropriate "My Computer" | |||
For Windows, set the <code>ANT_OPTS</code> environment variable in the appropriate "My Computer" | |||
properties dialog box (winXP), "Computer" properties (Vista) | |||
</p> | |||
<p> | |||
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. | |||
</p> | |||
<p> | |||
<p> | |||
It is limited in the following ways: | |||
</p> | |||
</p> | |||
<ol> | |||
<li>Does not work under IDEs. These need their own proxy settings changed</li> | |||
<li>Not dynamic enough to deal with laptop configuration changes.</li> | |||
</ol> | |||
<h3>SetProxy Task</h3> | |||
<p> | |||
The <a href="Tasks/setproxy.html">setproxy task</a> 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. | |||
</p> | |||
<p> | |||
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). | |||
</p> | |||
<p> | |||
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: | |||
</p> | |||
@@ -214,10 +207,10 @@ command line. | |||
<h3>Custom ProxySelector implementations</h3> | |||
<p> | |||
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. | |||
</p> | |||
<p> | |||
This could be the most flexible of solutions, as one could easily imagine | |||
@@ -239,14 +232,15 @@ command line. | |||
<code>fork="true"</code> will pick up the Ant's settings. If you need | |||
different values, set <code>fork="false"</code> and provide the values | |||
in <code><sysproperty></code> elements. | |||
</p> | |||
</p> | |||
<p> | |||
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 | |||
<a href="Types/propertyset.html"><code><syspropertyset></code></a> | |||
element to propagate the normal proxy settings. The following propertyset | |||
is a datatype which can be referenced in a <code><java></code> task to | |||
pass down the current values. | |||
</p> | |||
<pre> | |||
<propertyset id="proxy.properties"> | |||
@@ -25,7 +25,7 @@ | |||
<body> | |||
<h1>Running Apache Ant</h1> | |||
<h2><a name="commandline">Command Line</a></h2> | |||
<h2 id="commandline">Command Line</h2> | |||
<p> If you've installed Apache Ant as described in the | |||
<a href="install.html"> Installing Ant</a> section, | |||
running Ant from the command-line is simple: just type | |||
@@ -36,10 +36,10 @@ build file and runs the target specified in the <code>default</code> | |||
attribute of the <code><project></code> tag. | |||
To make Ant use | |||
a build file other than <code>build.xml</code>, use the command-line | |||
option <nobr><code>-buildfile <i>file</i></code></nobr>, | |||
option <code>-buildfile <i>file</i></code>, | |||
where <i>file</i> is the name of the build file you want to use | |||
(or a directory containing a <code>build.xml</code> file).</p> | |||
If you use the <nobr><code>-find [<i>file</i>]</code></nobr> option, | |||
If you use the <code>-find [<i>file</i>]</code> 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 <code>build.xml</code>. To have it search for a build file other | |||
than <code>build.xml</code>, specify a file argument. | |||
<strong>Note:</strong> If you include any other flags or arguments | |||
on the command line after | |||
the <nobr><code>-find</code></nobr> flag, you must include the file argument | |||
for the <nobr><code>-find</code></nobr> flag, even if the name of the | |||
the <code>-find</code> flag, you must include the file argument | |||
for the <code>-find</code> flag, even if the name of the | |||
build file you want to find is <code>build.xml</code>. | |||
<p>You can also set <a href="using.html#properties">properties</a> on the | |||
command line. This can be done with | |||
the <nobr><code>-D<i>property</i>=<i>value</i></code></nobr> option, | |||
the <code>-D<i>property</i>=<i>value</i></code> option, | |||
where <i>property</i> is the name of the property, | |||
and <i>value</i> 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 | |||
<nobr><code>-DMYVAR=%MYVAR%</code></nobr> (Windows) or | |||
<nobr><code>-DMYVAR=$MYVAR</code></nobr> (Unix) | |||
<code>-DMYVAR=%MYVAR%</code> (Windows) or | |||
<code>-DMYVAR=$MYVAR</code> (Unix) | |||
to Ant. You can then access | |||
these variables inside your build file as <code>${MYVAR}</code>. | |||
You can also access environment variables using the | |||
@@ -73,13 +73,13 @@ You can also access environment variables using the | |||
</p> | |||
<p>Options that affect the amount of logging output by Ant are: | |||
<nobr><code>-quiet</code></nobr>, | |||
<code>-quiet</code>, | |||
which instructs Ant to print less | |||
information to the console; | |||
<nobr><code>-verbose</code></nobr>, which causes Ant to print | |||
additional information to the console; <nobr><code>-debug</code></nobr>, | |||
<code>-verbose</code>, which causes Ant to print | |||
additional information to the console; <code>-debug</code>, | |||
which causes Ant to print considerably more additional information; and | |||
<nobr><code>-silent</code></nobr> which makes Ant print nothing but task | |||
<code>-silent</code> which makes Ant print nothing but task | |||
output and build failures (useful to capture Ant output by scripts). | |||
</p> | |||
@@ -89,7 +89,7 @@ When omitted, the target that is specified in the | |||
<a href="using.html#projects"><code>project</code></a> tag is | |||
used.</p> | |||
<p>The <nobr><code>-projecthelp</code></nobr> option prints out a list | |||
<p>The <code>-projecthelp</code> option prints out a list | |||
of the build file's targets. Targets that include a | |||
<code>description</code> attribute are listed as "Main targets", | |||
those without a <code>description</code> are listed as | |||
@@ -97,7 +97,7 @@ those without a <code>description</code> are listed as | |||
("Other targets" are only displayed if there are no main | |||
targets, or if Ant is invoked in -verbose or -debug mode). | |||
<h3><a name="options">Command-line Options Summary</a></h3> | |||
<h3 id="options">Command-line Options Summary</h3> | |||
<pre>ant [options] [target [target2 [target3] ...]] | |||
Options: | |||
-help, -h print this message and exit | |||
@@ -139,20 +139,20 @@ Options: | |||
<a href="listeners.html">Loggers & Listeners</a>. | |||
<p>For more information about <code>-inputhandler</code> see | |||
<a href="inputhandler.html">InputHandler</a>. | |||
<p>Easiest way of changing the exit-behaviour is subclassing the original main class: | |||
<p>Easiest way of changing the exit-behaviour is subclassing the original main class:</p> | |||
<pre> | |||
public class CustomExitCode extends org.apache.tools.ant.Main { | |||
protected void exit(int exitCode) { | |||
// implement your own behaviour, e.g. NOT exiting the JVM | |||
} | |||
} | |||
</pre> and starting Ant with access (<tt>-lib path-to-class</tt>) to this class. | |||
</p> | |||
</pre> | |||
<p>and starting Ant with access (<tt>-lib path-to-class</tt>) to this class.</p> | |||
<h3><a name="libs">Library Directories</a></h3> | |||
<h3 id="libs">Library Directories</h3> | |||
<p> | |||
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. <em>Since Ant 1.6</em>, | |||
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. | |||
</p> | |||
<p> | |||
@@ -229,9 +228,7 @@ to the value <code>build/classes</code>.</p> | |||
</blockquote> | |||
<p>adds two jars to Ants classpath.</p> | |||
<h3><a name="files">Files</a></h3> | |||
<h3 id="files">Files</h3> | |||
<p>The Ant wrapper script for Unix will source (read and evaluate) the | |||
file <code>~/.antrc</code> before it does anything. On Windows, the Ant | |||
@@ -240,7 +237,7 @@ wrapper batch-file invokes <code>%HOME%\antrc_pre.bat</code> 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.</p> | |||
<h3><a name="envvars">Environment Variables</a></h3> | |||
<h3 id="envvars">Environment Variables</h3> | |||
<p>The wrapper scripts use the following environment variables (if | |||
set):</p> | |||
@@ -255,24 +252,24 @@ set):</p> | |||
<li><code>ANT_ARGS</code> - Ant command-line arguments. For example, | |||
set <code>ANT_ARGS</code> to point to a different logger, include a | |||
listener, and to include the <code>-find</code> flag.</li> | |||
listener, and to include the <code>-find</code> flag.<br/> | |||
<strong>Note:</strong> If you include <code>-find</code> | |||
in <code>ANT_ARGS</code>, you should include the name of the build file | |||
to find, even if the file is called <code>build.xml</code>. | |||
to find, even if the file is called <code>build.xml</code>.</li> | |||
</ul> | |||
<h3><a name="sysprops">Java System Properties</a></h3> | |||
<h3 id="sysprops">Java System Properties</h3> | |||
<p>Some of Ant's core classes can be configured via system properties.</p> | |||
<p>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</p> | |||
<pre> | |||
grep -r -n "getPropert" * > ..\grep.txt | |||
</pre> | |||
command. After that I filtered out the often-used but not-so-important values (most of them | |||
<p>command. After that I filtered out the often-used but not-so-important values (most of them | |||
read-only values): <i>path.separator, ant.home, basedir, user.dir, os.name, | |||
line.separator, java.home, java.version, java.version, user.home, java.class.path</i><br> | |||
And I filtered out the <i>getPropertyHelper</i> access.</p> | |||
<table border="1"> | |||
<table> | |||
<tr> | |||
<th>property name</th> | |||
<th>valid values /default value</th> | |||
@@ -291,12 +288,11 @@ And I filtered out the <i>getPropertyHelper</i> access.</p> | |||
<tr> | |||
<td><code>ant.executor.class</code></td> | |||
<td>classname; default is org. apache. tools. ant. helper. DefaultExecutor</td> | |||
<td><b>Since Ant 1.6.3</b> Ant will delegate Target invocation to the | |||
<td><em>Since Ant 1.6.3</em> Ant will delegate Target invocation to the | |||
org.apache.tools.ant.Executor implementation specified here. | |||
</td> | |||
</tr> | |||
<tr> | |||
<tr> | |||
<td><code>ant.file</code></td> | |||
<td>read only: full filename of the build file</td> | |||
<td>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</a> files, this is set to the containing build file. | |||
</td> | |||
</tr> | |||
<tr> | |||
<tr> | |||
<td><code>ant.file.*</code></td> | |||
<td>read only: full filename of the build file of Ant projects | |||
</td> | |||
@@ -314,8 +309,7 @@ org.apache.tools.ant.Executor implementation specified here. | |||
<import>-ed</a> files, | |||
</td> | |||
</tr> | |||
<tr> | |||
<tr> | |||
<td><code>ant.input.properties</code></td> | |||
<td>filename (required)</td> | |||
<td>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. | |||
</p> | |||
<h2><a name="cygwin">Cygwin Users</a></h2> | |||
<h2 id="cygwin">Cygwin Users</h2> | |||
<p>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. | |||
</p> | |||
<h2><a name="os2">OS/2 Users</a></h2> | |||
<h2 id="os2">OS/2 Users</h2> | |||
<p>The OS/2 launch script was developed to perform complex tasks. It has two parts: | |||
<code>ant.cmd</code> which calls Ant and <code>antenv.cmd</code> which sets the environment for Ant. | |||
Most often you will just call <code>ant.cmd</code> using the same command line options as described | |||
@@ -552,8 +546,8 @@ shell (of course unless called automatically from <code>ant.cmd</code>). It is t | |||
<p>Scripts <code>envset.cmd</code> and <code>runrc.cmd</code> perform auxiliary tasks. All scripts | |||
have some documentation inside.</p> | |||
<h2><a name="background">Running Ant as a background process on | |||
Unix(-like) systems</a></h2> | |||
<h2 id="background">Running Ant as a background process on | |||
Unix(-like) systems</h2> | |||
<p>If you start Ant as a background process (like in <code>ant | |||
&</code>) and the build process creates another process, Ant will | |||
@@ -568,7 +562,7 @@ have some documentation inside.</p> | |||
or <code><java></code> when the <code>fork</code> attribute is | |||
<code>true</code>.</p> | |||
<h2><a name="viajava">Running Ant via Java</a></h2> | |||
<h2 id="viajava">Running Ant via Java</h2> | |||
<p>If you have installed Ant in the do-it-yourself way, Ant can be started | |||
from one of two entry points:</p> | |||
<blockquote> | |||
@@ -599,11 +593,10 @@ The latter method supports the -lib, -nouserlib, -noclasspath options and will | |||
classpath possible, generally just the ant-launcher.jar. | |||
</p> | |||
<a name="viaant"/> | |||
Ant can be started in Ant via the <code><java></code> command. | |||
Here is an example: | |||
<p id="viaant"> | |||
Ant can be started in Ant via the <code><java></code> command. | |||
Here is an example: | |||
</p> | |||
<pre> | |||
<java | |||
classname="org.apache.tools.ant.launch.Launcher" | |||
@@ -624,8 +617,6 @@ Here is an example: | |||
<arg value="${sub.target}"/> | |||
</java> | |||
</pre> | |||
<br> | |||
</body> | |||
</html> |
@@ -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; | |||
} |
@@ -24,7 +24,7 @@ | |||
<body> | |||
<h2><a name="sysclasspath">build.sysclasspath</a></h2> | |||
<h2 id="sysclasspath">build.sysclasspath</h2> | |||
<p>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.</p> | |||
The values and their meanings are: | |||
<table cellspacing="20"> | |||
<table> | |||
<tr><th>value</th><th>meaning</th></tr> | |||
<tr> | |||
<td align="left" valign="top">only</td> | |||
@@ -23,7 +23,7 @@ | |||
</head> | |||
<body> | |||
<h1><a name="targets">Targets</a></h1> | |||
<h1 id="targets">Targets</h1> | |||
<p>A target is a container of tasks that cooperate to reach a | |||
desired state during the build process.</p> | |||
@@ -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.</p> | |||
<blockquote><pre><b>Call-Graph:</b> A --> B --> C --> D</pre></blockquote> | |||
<p>In a chain of dependencies stretching back from a given target | |||
@@ -116,7 +116,7 @@ | |||
<p>If no <code>if</code> and no <code>unless</code> attribute is | |||
present, the target will always be executed.</p> | |||
<p><b>Important:</b> the <code>if</code> and <code>unless</code> | |||
<p><b>Important</b>: the <code>if</code> and <code>unless</code> | |||
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 @@ | |||
<p>A target has the following attributes:</p> | |||
<table border="1" cellpadding="2" cellspacing="0"> | |||
<table> | |||
<tr> | |||
<td valign="top"><b>Attribute</b></td> | |||
<td valign="top"><b>Description</b></td> | |||
@@ -213,7 +213,7 @@ | |||
"warn", "ignore"). | |||
<em>since Ant 1.8.2.</em></td> | |||
<td align="center" valign="top">No. Not allowed unless | |||
<code>extensionOf</code> is present. Defaults to <code>fail</code>. | |||
<code>extensionOf</code> is present. Defaults to <code>fail</code>. | |||
</td> | |||
</tr> | |||
</table> | |||
@@ -236,7 +236,7 @@ | |||
don't use Ants main class as entry point and calling them from the IDE | |||
is usually possible.</p> | |||
<h1><a name="extension-points">Extension-Points</a></h1> | |||
<h1 id="extension-points">Extension-Points</h1> | |||
<p><em>since Ant 1.8.0.</em></p> | |||
@@ -248,16 +248,16 @@ | |||
is to collect targets that contribute to the desired state in | |||
their depends list.</p> | |||
<p>Targets can add themselves to an extension-points's depends list via | |||
<p>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.</p> | |||
<p>The main purpose of an extension-point is to act as an extension | |||
point for build files designed to | |||
be <a href="Tasks/import.html">imported</a>. 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.</p> | |||
@@ -276,7 +276,6 @@ | |||
<blockquote><pre><b>Call-Graph:</b> create-directory-layout --> 'empty slot' --> compile</pre></blockquote> | |||
<p>And you need to generate some source before compilation, then in | |||
your main build file you may use something like</p> | |||
<blockquote><pre> | |||
@@ -288,7 +287,6 @@ | |||
<blockquote><pre><b>Call-Graph:</b> create-directory-layout --> generate-sources --> compile</pre></blockquote> | |||
<p>This will ensure that the <em>generate-sources</em> target is | |||
executed before the <em>compile</em> target.</p> | |||
@@ -48,4 +48,3 @@ | |||
</body> | |||
</html> | |||
@@ -22,29 +22,25 @@ | |||
<body> | |||
<h1>Tutorial: Hello World with Apache Ant</h1> | |||
<p>This document provides a step by step tutorial for starting java programming with Apache Ant. | |||
<p>This document provides a step by step tutorial for starting Java programming with Apache Ant. | |||
It does <b>not</b> contain deeper knowledge about Java or Ant. This tutorial has the goal | |||
to let you see, how to do the easiest steps in Ant.</p> | |||
<h2>Content</h2> | |||
<p><ul> | |||
<ul> | |||
<li><a href="#prepare">Preparing the project</a></li> | |||
<li><a href="#four-steps">Enhance the build file</a></li> | |||
<li><a href="#enhance">Enhance the build file</a></li> | |||
<li><a href="#ext-libs">Using external libraries</a></li> | |||
<li><a href="#resources">Resources</a></li> | |||
</ul></p> | |||
</ul> | |||
<a name="prepare"></a> | |||
<h2>Preparing the project</h2> | |||
<h2 id="prepare">Preparing the project</h2> | |||
<p>We want to separate the source from the generated files, so our java source files will | |||
be in <tt>src</tt> folder. All generated files should be under <tt>build</tt>, and there | |||
splitted into several subdirectories for the individual steps: <tt>classes</tt> for our compiled | |||
files and <tt>jar</tt> for our own JAR-file.</p> | |||
<p>We have to create only the <tt>src</tt> directory. (Because I am working on Windows, here is | |||
<p>We have to create only the <tt>src</tt> directory. (Because I am working on Windows, here is | |||
the win-syntax - translate to your shell):</p> | |||
<pre class="code"> | |||
@@ -64,7 +60,7 @@ public class HelloWorld { | |||
} | |||
</pre> | |||
<p>Now just try to compile and run that: | |||
<p>Now just try to compile and run that:</p> | |||
<pre class="code"> | |||
md build\classes | |||
javac -sourcepath src -d build\classes src\oata\HelloWorld.java | |||
@@ -74,7 +70,6 @@ which will result in | |||
<pre class="output"> | |||
Hello World | |||
</pre> | |||
</p> | |||
<p>Creating a jar-file is not very difficult. But creating a <i>startable</i> jar-file needs more steps: create a | |||
manifest-file containing the start class, creating the target directory and archiving the files.</p> | |||
@@ -85,12 +80,10 @@ jar cfm build\jar\HelloWorld.jar myManifest -C build\classes . | |||
java -jar build\jar\HelloWorld.jar | |||
</pre> | |||
<p><b>Note:</b> Do not have blanks around the >-sign in the <tt>echo Main-Class</tt> instruction because it would | |||
<p><b>Note:</b> Do not have blanks around the >-sign in the <tt>echo Main-Class</tt> instruction because it would | |||
falsify it!</p> | |||
<a name="four-steps"></a> | |||
<h2>Four steps to a running application</h2> | |||
<h2 id="four-steps">Four steps to a running application</h2> | |||
<p>After finishing the java-only step we have to think about our build process. We <i>have</i> to compile our code, otherwise we couldn't | |||
start the program. Oh - "start" - yes, we could provide a target for that. We <i>should</i> 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 | |||
</pre> | |||
<p>While having a look at the buildfile, we will see some similar steps between Ant and the java-only commands: | |||
<p>While having a look at the buildfile, we will see some similar steps between Ant and the Java-only commands:</p> | |||
<table> | |||
<tr> | |||
<th>java-only</th> | |||
@@ -182,19 +175,14 @@ java -jar build\jar\HelloWorld.jar | |||
<java jar="build/jar/HelloWorld.jar" fork="true"/> | |||
</pre></td> | |||
</tr></table> | |||
</p> | |||
<a name="enhance"></a> | |||
<h2>Enhance the build file</h2> | |||
<h2 id="enhance">Enhance the build file</h2> | |||
<p>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.</p> | |||
<p>The first and second point would be addressed with <i>properties</i>, the third with a special property - an attribute | |||
of the <project>-tag and the fourth problem can be solved using dependencies.</p> | |||
<pre class="code"> | |||
<project name="HelloWorld" basedir="." default="main"> | |||
@@ -237,7 +225,6 @@ of the <project>-tag and the fourth problem can be solved using dependenci | |||
</project> | |||
</pre> | |||
<p>Now it's easier, just do a <tt class="code">ant</tt> and you will get</p> | |||
<pre class="output"> | |||
Buildfile: build.xml | |||
@@ -260,16 +247,15 @@ main: | |||
BUILD SUCCESSFUL | |||
</pre> | |||
<a name="ext-libs"></a> | |||
<h2>Using external libraries</h2> | |||
<h2 id="ext-libs">Using external libraries</h2> | |||
<p>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 <ul> | |||
degree (including switching off during usual life (= not development) execution). We use Log4J for that, because</p> | |||
<ul> | |||
<li>it is not part of the JDK (1.4+) and we want to show how to use external libs</li> | |||
<li>it can run under JDK 1.2 (as Ant)</li> | |||
<li>it's highly configurable</li> | |||
<li>it's from Apache ;-)</li> | |||
</ul></p> | |||
</ul> | |||
<p>We store our external libraries in a new directory <tt>lib</tt>. Log4J can be | |||
<a href="http://www.apache.org/dist/logging/log4j/1.2.13/logging-log4j-1.2.13.zip">downloaded [1]</a> from Logging's Homepage. | |||
Create the <tt>lib</tt> 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 <i>and</i> a classpath. So add our class in the red line to the alread | |||
[java] 0 [main] INFO oata.HelloWorld - Hello World | |||
</pre> | |||
<p>What's that? <ul> | |||
<p>What's that?</p> | |||
<ul> | |||
<li><i>[java]</i> Ant task running at the moment</li> | |||
<li><i>0</i> <font size="-1">sorry don't know - some Log4J stuff</font></li> | |||
<li><i>[main]</i> the running thread from our application </li> | |||
<li><i>INFO</i> log level of that statement</i> | |||
<li><i>oata.HelloWorld</i> source of that statement</i> | |||
<li><i>INFO</i> log level of that statement</li> | |||
<li><i>oata.HelloWorld</i> source of that statement</li> | |||
<li><i>-</i> separator</li> | |||
<li><i>Hello World</i> the message</li> | |||
</ul> | |||
For another layout ... have a look inside Log4J's documentation about using other PatternLayout's.</p> | |||
<p>For another layout ... have a look inside Log4J's documentation about using other PatternLayout's.</p> | |||
<a name="config-files"> | |||
<h2>Configuration files</h2> | |||
<h2 id="config-files">Configuration files</h2> | |||
<p>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 <tt>BasicConfigurator.configure();</tt> 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 <tt>src/log4j.properties</tt>. 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 <tt>src/log4j.properties</tt>. 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!</p> | |||
<pre class="code"> | |||
@@ -389,9 +374,7 @@ finished yet. We should deliver the configuration file, too. So we change the bu | |||
<p>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.</p> | |||
<a name="junit"> | |||
<h2>Testing the class</h2> | |||
<h2 id="junit">Testing the class</h2> | |||
<p>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 <tt>src\HelloWorldTest.java</tt>: </p> | |||
@@ -400,14 +383,14 @@ public class HelloWorldTest extends junit.framework.TestCase { | |||
public void testNothing() { | |||
} | |||
public void testWillAlwaysFail() { | |||
fail("An error message"); | |||
} | |||
}</pre> | |||
<p>Because we dont have real business logic to test, this test class is very small: just show how to start. For | |||
<p>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 <a href="Tasks/junit.html">junit</a> task. | |||
Now we add a junit instruction to our buildfile:</p> | |||
@@ -424,14 +407,14 @@ Now we add a junit instruction to our buildfile:</p> | |||
</classpath> | |||
</java> | |||
</target> | |||
<b><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 | |||
... | |||
</pre> | |||
<p>We can also produce a report. Something that you (and other) could read after closing the shell .... | |||
<p>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).<p> | |||
<pre class="code"> | |||
@@ -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> | |||
<b><formatter type="xml"/></b> | |||
<batchtest fork="yes" <b>todir="${report.dir}"</b>> | |||
<fileset dir="${src.dir}" includes="*Test.java"/> | |||
</batchtest> | |||
</junit> | |||
</target> | |||
<b><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 | |||
<p>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 <tt>junit</tt> and redirect the logging to it. The log format | |||
is XML so <tt>junitreport</tt> could parse it. In a second target <tt>junitreport</tt> should create a browsable | |||
is XML so <tt>junitreport</tt> could parse it. In a second target <tt>junitreport</tt> 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).<br> | |||
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. | |||
</p> | |||
<a name="resources"></a> | |||
<h2>Resources</h2> | |||
<h2 id="resources">Resources</h2> | |||
<pre> | |||
[1] <a href="http://www.apache.org/dist/logging/log4j/1.2.13/logging-log4j-1.2.13.zip">http://www.apache.org/dist/logging/log4j/1.2.13/logging-log4j-1.2.13.zip</a> | |||
[2] <a href="http://logging.apache.org/log4j/docs/manual.html">http://logging.apache.org/log4j/docs/manual.html</a> | |||
[3] <a href="http://www.junit.org/index.htm">http://www.junit.org/index.htm</a> | |||
</pre> | |||
</body> | |||
</html> |
@@ -27,7 +27,7 @@ tasks [1]</a> 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.</p> | |||
<h2>Content</h2> | |||
<p><ul> | |||
<ul> | |||
<li><a href="#goal">The goal</a></li> | |||
<li><a href="#buildenvironment">Build environment</a></li> | |||
<li><a href="#propertyaccess">Property access</a></li> | |||
@@ -37,15 +37,13 @@ nested filesets and paths. Finally it explains how to contribute tasks to Apache | |||
<li><a href="#documentation">Documentation</a></li> | |||
<li><a href="#contribute">Contribute the new task</a></li> | |||
<li><a href="#resources">Resources</a></li> | |||
</ul></p> | |||
</ul> | |||
<h2><a name="goal">The goal</a></h2> | |||
<h2 id="goal">The goal</h2> | |||
<p>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.</p> | |||
<h2><a name="buildenvironment">Build environment</a></h2> | |||
<h2 id="buildenvironment">Build environment</h2> | |||
<p>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. :-)</p> | |||
<pre class="code"> | |||
@@ -65,10 +63,9 @@ That's the advantage of using properties - we can reuse nearly the whole script. | |||
tutorial-tasks-filesets-properties.zip [2]</a> in <tt>/build.xml.01-propertyaccess</tt> | |||
(future version saved as *.02..., final version as build.xml; same for sources).</p> | |||
<h2><a name="propertyaccess">Property access</a></h2> | |||
<h2 id="propertyaccess">Property access</h2> | |||
<p>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</p> | |||
<pre class="code"> | |||
<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}"/> | |||
</pre> | |||
but I have to start on known ground :-)</p> | |||
<p>but I have to start on known ground :-)</p> | |||
<p>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:</p> | |||
<pre class="code"> | |||
import org.apache.tools.ant.BuildException; | |||
@@ -110,7 +107,7 @@ public class Find extends Task { | |||
} | |||
</pre> | |||
As said in the other tutorial, the property access is done via Project instance. | |||
<p>As said in the other tutorial, the property access is done via Project instance. | |||
We get this instance via the public <tt>getProject()</tt> method which we inherit from | |||
<tt>Task</tt> (more precise from ProjectComponent). Reading a property is done via | |||
<tt>getProperty(<i>propertyname</i>)</tt> (very simple, isn't it?). This property returns | |||
@@ -132,7 +129,7 @@ caller.)</i></p> | |||
to them, sorry :-)</p> | |||
<p>After putting our two line example from above into a target names <tt>use.simple</tt> | |||
we can call that from our testcase: | |||
we can call that from our testcase:</p> | |||
<pre class="code"> | |||
import org.junit.Rule; | |||
@@ -161,26 +158,23 @@ public class FindTest { | |||
} | |||
</pre> | |||
and all works fine.</p> | |||
<p>and all works fine.</p> | |||
<h2><a name="filesets">Using filesets</a></h2> | |||
<h2 id="filesets">Using filesets</h2> | |||
<p>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</p> | |||
<pre class="code"> | |||
<find file="ant.jar" location="location.ant-jar"> | |||
<fileset dir="${ant.home}" includes="**/*.jar"/> | |||
</find> | |||
</pre> | |||
</p> | |||
<p>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:</p> | |||
<pre class="code"> | |||
public class Find extends Task { | |||
@@ -204,18 +198,19 @@ public class Find extends Task { | |||
} | |||
} | |||
</pre> | |||
Ok - that task wouldn't do very much, but we can use it in the described manner without | |||
<p>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).</p> | |||
<p>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?<ul> | |||
to write a target than doing it via java coding). What can be tested?</p> | |||
<ul> | |||
<li>not valid configured task (missing file, missing location, missing fileset)</li> | |||
<li>don't find a present file</li> | |||
<li>behaviour if file can't be found</li> | |||
</ul> | |||
Maybe you find some more testcases. But this is enough for now.<br> | |||
<p>Maybe you find some more testcases. But this is enough for now.<br> | |||
For each of these points we create a <tt>testXX</tt> method.</p> | |||
<pre class="code"> | |||
@@ -351,8 +346,7 @@ Therefore we have do modify our buildfile: | |||
</target> | |||
</pre> | |||
<h2><a name="path">Using nested paths</a></h2> | |||
<h2 id="path">Using nested paths</h2> | |||
<p>A task providing support for filesets is a very comfortable one. But there is another | |||
possibility of bundling files: the <code><path></code>. 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:</p> | |||
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).</p> | |||
<h2><a name="returning-list">Returning a list</a></h2> | |||
<h2 id="returning-list">Returning a list</h2> | |||
<p>So far so good. But could a file be on more than one place in the path? - Of course.<br> | |||
And would it be good to get all of them? - It depends on ...<p> | |||
@@ -445,13 +437,14 @@ elements are concatenated and separated with a customizable separator (default ' | |||
<p>If the delimiter is set we will return all found files as list with that delimiter.</p> | |||
<p>Therefore we have to<ul> | |||
<p>Therefore we have to</p> | |||
<ul> | |||
<li>provide a new attribute</li> | |||
<li>collect more than the first file</li> | |||
<li>delete duplicates</li> | |||
<li>create the list if necessary</li> | |||
<li>return that list</li> | |||
</ul></p> | |||
</ul> | |||
<p>So we add as testcase:</p> | |||
<pre class="code"> | |||
@@ -559,8 +552,7 @@ delimiter.</p> | |||
<p>Ok, first searching for all files and then returning only the first one ... You can | |||
tune the performance of your own :-)</p> | |||
<h2><a name="documentation">Documentation</a></h2> | |||
<h2 id="documentation">Documentation</h2> | |||
<p>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="<b>taskname</b>"><b>Taskname</b></a></h2> | |||
<h2& id="<b>taskname</b>"><b>Taskname</b></h2> | |||
<h3>Description</h3> | |||
<p> <b>Describe the task.</b></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> | |||
</pre> | |||
<h2><a name="contribute">Contribute the new task</a></h2> | |||
If we decide to contribute our task, we should do some things:<ul> | |||
<h2 id="contribute">Contribute the new task</h2> | |||
If we decide to contribute our task, we should do some things: | |||
<ul> | |||
<li>is our task welcome? :-) Simply ask on the user list</li> | |||
<li>is the right package used? </li> | |||
<li>does the code conform to the styleguide?</li> | |||
@@ -713,7 +705,7 @@ If we decide to contribute our task, we should do some things:<ul> | |||
<li>create a patch file</li> | |||
<li>publishing that patch file</li> | |||
</ul> | |||
The <a href="http://ant.apache.org/ant_task_guidelines.html">Ant Task Guidelines [6]</a> support additional | |||
<p>The <a href="http://ant.apache.org/ant_task_guidelines.html">Ant Task Guidelines [6]</a> support additional | |||
information on that.</p> | |||
<p>Now we will check the "Checklist before submitting a new task" described in that guideline. | |||
@@ -738,7 +730,6 @@ tasks <b><i>to do</i></b></li> | |||
test and patches zipped up to escape the HTML filter. <b><i>to do</i></b></li> | |||
</ul> | |||
<h3>Package / Directories</h3> | |||
<p>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 <tt>src/etc/testcases</tt>.</p> | |||
<p>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 <a href="http://ant.apache.org/cvs.html">Access the Source Tree (AnonCVS) | |||
[7]</a> (password is <i>anoncvs</i>):<pre class="output"> | |||
[7]</a> (password is <i>anoncvs</i>):</p> | |||
<pre class="output"> | |||
cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic login //1 | |||
cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout ant //2 | |||
</pre> | |||
@@ -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 | |||
</pre></p> | |||
</pre> | |||
<p>We use the <i>-d</i> flag on <b>//1</b> 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 <b>//4</b>.</p> | |||
<p>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):</p> | |||
<pre class="output"> | |||
ANTHOME> build // 1 | |||
ANTHOME> set ANT_HOME=%CD%\dist // 2 | |||
ANTHOME> ant test -Dtest.haltonfailure=false // 3 | |||
</pre> | |||
First we have to build our Ant distribution (<b>//1</b>). On <b>//2</b> we set the ANT_HOME | |||
<p>First we have to build our Ant distribution (<b>//1</b>). On <b>//2</b> 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 <b>//3</b> 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 | |||
</pre> | |||
Because we only want to test our new class, we use the target for single tests, specify | |||
<p>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 (<b>//1 + 2</b>).</p> | |||
@@ -821,7 +813,7 @@ failures of our own test (<b>//1 + 2</b>).</p> | |||
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 <tt>find=org.apache.tools.ant.taskdefs.Find</tt> as the last core | |||
task (just before the <tt># optional tasks</tt> line). Now a second try: | |||
task (just before the <tt># optional tasks</tt> line). Now a second try:</p> | |||
<pre class="output"> | |||
ANTHOME> build // 1 | |||
ANTHOME> ant run-single-test | |||
@@ -835,7 +827,7 @@ breaks some other tests. | |||
<pre class="output"> | |||
ANTHOME> ant test -Dtest.haltonfailure=false | |||
</pre> | |||
Because there are a lot of tests this step requires a little bit of time. So use the <i>run-single-test</i> | |||
<p>Because there are a lot of tests this step requires a little bit of time. So use the <i>run-single-test</i> | |||
during development and do the <i>test</i> only at the end (maybe sometimes during development too). | |||
We use the <i>-Dtest.haltonfailure=false</i> here because there could be other tests fail and we have | |||
to look into them.</p> | |||
@@ -843,12 +835,9 @@ to look into them.</p> | |||
<p>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).</p> | |||
<h3>Apache license statement</h3> | |||
<p>Simply copy the license text from one the other source from the Ant source tree.</p> | |||
<h3>Test on JDK 1.2</h3> | |||
<p>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 <tt>ant test</tt> (like above).</p> | |||
<p>Our test should pass.</p> | |||
<h3>Checkstyle</h3> | |||
<p>There are many things we have to ensure. Indentation with 4 spaces, blanks here and there, ... | |||
(all described in the <a href="http://ant.apache.org/ant_task_guidelines.html">Ant Task Guidelines [6]</a> which | |||
@@ -875,11 +862,11 @@ for us.</p> | |||
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).</p> | |||
<p>So we will run the tests with | |||
<p>So we will run the tests with</p> | |||
<pre class="output"> | |||
ANTHOME> ant -f check.xml checkstyle htmlreport | |||
</pre> | |||
I prefer the HTML report because there are lots of messages and we can navigate faster. | |||
<p>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.</p> | |||
@@ -890,8 +877,6 @@ up to date and you will find the next error place much more easier without redoi | |||
<p>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 :-)</p> | |||
<!-- | |||
Couldnt create the diff that way for myself, but that should be documented. | |||
But on the other hand this tutorial should not be forgotten any longer so I | |||
@@ -902,13 +887,12 @@ automatically. This step requires a cvs executable in your path and internet acc | |||
cvs access). As a result we get a file <i> TODO </i>.</p> | |||
--> | |||
<h3>Publish the task</h3> | |||
<p>Finally we publish that archive. As described in the <a href="http://ant.apache.org/ant_task_guidelines.html"> | |||
Ant Task Guidelines [7]</a> we can post it on the developer mailinglist or we create a BugZilla | |||
entry. For both we need some information:</p> | |||
<table border="1"> | |||
<table> | |||
<tr> | |||
<th>subject</th> | |||
<td><i>short description</i></td> | |||
@@ -963,31 +947,27 @@ and the steps described there if you haven't one.</p> | |||
</ol> | |||
Now the new task is uploaded into the bug database. | |||
<h2><a name="resources">Resources</a></h2> | |||
[1] <a href="tutorial-writing-tasks.html">tutorial-writing-tasks.html</a><br> | |||
[2] <a href="tutorial-tasks-filesets-properties.zip">tutorial-tasks-filesets-properties.zip</a><br> | |||
[3] <a href="properties.html#built-in-props">properties.html#built-in-props</a><br> | |||
[4] <a href="http://ant-contrib.sourceforge.net/">http://ant-contrib.sourceforge.net/</a><br> | |||
[5] <a href="Tasks/java.html">Tasks/java.html</a><br> | |||
[6] <a href="http://ant.apache.org/ant_task_guidelines.html">http://ant.apache.org/ant_task_guidelines.html</a><br> | |||
[7] <a href="http://ant.apache.org/cvs.html">http://ant.apache.org/cvs.html</a><br> | |||
[8] <a href="http://www.oracle.com/technetwork/java/archive-139210.html">http://www.oracle.com/technetwork/java/archive-139210.html</a><br> | |||
[9] <a href="http://www.oracle.com/technetwork/java/codeconvtoc-136057.html">http://www.oracle.com/technetwork/java/codeconvtoc-136057.html</a><br> | |||
[10] <a href="http://checkstyle.sourceforge.net/">http://checkstyle.sourceforge.net/</a><br> | |||
[11] <a href="http://issues.apache.org/bugzilla/">http://issues.apache.org/bugzilla/</a><br> | |||
[12] <a href="http://issues.apache.org/bugzilla/createaccount.cgi">http://issues.apache.org/bugzilla/createaccount.cgi</a><br> | |||
[13] <a href="http://issues.apache.org/bugzilla/enter_bug.cgi">http://issues.apache.org/bugzilla/enter_bug.cgi</a><br> | |||
<h2 id="resources">Resources</h2> | |||
<ol class="refs"> | |||
<li><a href="tutorial-writing-tasks.html">tutorial-writing-tasks.html</a></li> | |||
<li><a href="tutorial-tasks-filesets-properties.zip">tutorial-tasks-filesets-properties.zip</a></li> | |||
<li><a href="properties.html#built-in-props">properties.html#built-in-props</a></li> | |||
<li><a href="http://ant-contrib.sourceforge.net/">http://ant-contrib.sourceforge.net/</a></li> | |||
<li><a href="Tasks/java.html">Tasks/java.html</a></li> | |||
<li><a href="http://ant.apache.org/ant_task_guidelines.html">http://ant.apache.org/ant_task_guidelines.html</a></li> | |||
<li><a href="http://ant.apache.org/cvs.html">http://ant.apache.org/cvs.html</a></li> | |||
<li><a href="http://www.oracle.com/technetwork/java/archive-139210.html">http://www.oracle.com/technetwork/java/archive-139210.html</a></li> | |||
<li><a href="http://www.oracle.com/technetwork/java/codeconvtoc-136057.html">http://www.oracle.com/technetwork/java/codeconvtoc-136057.html</a></li> | |||
<li><a href="http://checkstyle.sourceforge.net/">http://checkstyle.sourceforge.net/</a></li> | |||
<li><a href="http://issues.apache.org/bugzilla/">http://issues.apache.org/bugzilla/</a></li> | |||
<li><a href="http://issues.apache.org/bugzilla/createaccount.cgi">http://issues.apache.org/bugzilla/createaccount.cgi</a></li> | |||
<li><a href="http://issues.apache.org/bugzilla/enter_bug.cgi">http://issues.apache.org/bugzilla/enter_bug.cgi</a></li> | |||
</ol> | |||
<!-- | |||
TODO: | |||
- how to create a path (path.xml / command line) | |||
--> | |||
</body> | |||
</html> |
@@ -41,8 +41,7 @@ tasks.</p> | |||
<li><a href="#resources">Resources</a></li> | |||
</ul> | |||
<a name="buildenvironment"></a> | |||
<h2>Set up the build environment</h2> | |||
<h2 id="buildenvironment">Set up the build environment</h2> | |||
<p>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.</p> | |||
<p>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: | |||
<a href="http://ant.apache.org/manual/properties.html#built-in-props" target="_blank"> | |||
build-in properties [1]</a> of Ant. | |||
<a name="write1"></a> | |||
<h2>Write the Task</h2> | |||
<h2 id="write1">Write the Task</h2> | |||
Now we write the simplest Task - a HelloWorld-Task (what else?). Create a text file | |||
<i>HelloWorld.java</i> in the src-directory with: | |||
@@ -123,10 +120,7 @@ public class HelloWorld { | |||
and we can compile and jar it with <tt>ant</tt> (default target is "jar" and via | |||
its <i>depends</i>-clause the "compile" is executed before). | |||
<a name="use1"></a> | |||
<h2>Use the Task</h2> | |||
<h2 id="use1">Use the Task</h2> | |||
<p>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 | |||
<a href="http://ant.apache.org/manual/Tasks/taskdef.html" target="_blank"> | |||
@@ -166,10 +160,7 @@ BUILD SUCCESSFUL | |||
Total time: 3 seconds | |||
</pre> | |||
<a name="TaskAdapter"></a> | |||
<h2>Integration with TaskAdapter</h2> | |||
<h2 id="TaskAdapter">Integration with TaskAdapter</h2> | |||
<p>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 <tt>public void execute()</tt>. This class is wrapped by Ant's | |||
@@ -202,9 +193,7 @@ use: | |||
Here is project 'MyTask'. | |||
</pre> | |||
<a name="derivingFromTask"></a> | |||
<h2>Deriving from Ant's Task</h2> | |||
<h2 id="derivingFromTask">Deriving from Ant's Task</h2> | |||
<p>Ok, that works ... But usually you will extend <tt>org.apache.tools.ant.Task</tt>. | |||
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: | |||
</pre> | |||
<a name="accessTaskProject"></a> | |||
<h2>Accessing the Task's Project</h2> | |||
<h2 id="accessTaskProject">Accessing the Task's Project</h2> | |||
<p>The parent project of your custom task may be accessed through method <code>getProject()</code>. 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 <code>execute()</code> is called, the Project object is available.</p> | |||
<p>Here are two useful methods from class Project:</p> | |||
<ul> | |||
@@ -247,8 +235,7 @@ use: | |||
<p>The method <code>replaceProperties()</code> is discussed further in section <a href="#NestedText">Nested Text</a>.</p> | |||
<a name="attributes"></a> | |||
<h2>Attributes</h2> | |||
<h2 id="attributes">Attributes</h2> | |||
<p>Now we want to specify the text of our message (it seems that we are | |||
rewriting the <code><echo/></code> task :-). First we well do that with an attribute. | |||
It is very easy - for each attribute provide a <tt>public void set<code><attributename></code>(<code><type></code> | |||
@@ -304,9 +291,7 @@ Helper</a></li> | |||
Before calling the set-method all properties are resolved. So a <tt><helloworld message="${msg}"/></tt> | |||
would not set the message string to "${msg}" if there is a property "msg" with a set value. | |||
<a name="NestedText"></a> | |||
<h2>Nested Text</h2> | |||
<h2 id="NestedText">Nested Text</h2> | |||
<p>Maybe you have used the <code><echo></code> task in a way like <tt><echo>Hello World</echo></tt>. | |||
For that you have to provide a <tt>public void addText(String text)</tt> method.</p> | |||
<pre class="code"> | |||
@@ -330,9 +315,7 @@ property name as argument and returns its value (or ${propname} if not set).</p> | |||
} | |||
</pre> | |||
<a name="NestedElements"></a> | |||
<h2>Nested Elements</h2> | |||
<h2 id="NestedElements">Nested Elements</h2> | |||
<p>There are several ways for inserting the ability of handling nested elements. See | |||
the <a href="http://ant.apache.org/manual/develop.html#nested-elements">Manual [4]</a> for other. | |||
We use the first way of the three described ways. There are several steps for that:</p><ol> | |||
@@ -387,8 +370,7 @@ the buildfile</p> | |||
<p>Note that if you choose to use methods 2 or 3, the class that represents the nested | |||
element must be declared as <code>static</code></p> | |||
<a name="complex"></a> | |||
<h2>Our task in a little more complex version</h2> | |||
<h2 id="complex">Our task in a little more complex version</h2> | |||
<p>For recapitulation now a little refactored buildfile:</p> | |||
<pre class="code"> | |||
<?xml version="1.0" encoding="ISO-8859-1"?> | |||
@@ -589,10 +571,7 @@ C:\tmp\anttests\MyFirstTask> | |||
</pre> | |||
Next step: test ... | |||
<a name="TestingTasks"></a> | |||
<h2>Test the Task</h2> | |||
<h2 id="TestingTasks">Test the Task</h2> | |||
<p>We have written a test already: the use.* tasks in the buildfile. But its | |||
difficult to test that automatically. Common (and in Ant) used is JUnit for | |||
that. For testing tasks Ant provides a JUnit Rule <tt>org.apache.tools.ant.BuildFileRule</tt>. | |||
@@ -771,9 +750,7 @@ Total time: 7 seconds | |||
C:\tmp\anttests\MyFirstTask> | |||
</pre> | |||
<a name="Debugging"></a> | |||
<h2>Debugging</h2> | |||
<h2 id="Debugging">Debugging</h2> | |||
<p>Try running Ant with the flag <code>-verbose</code>. For more information, try flag <code>-debug</code>.</p> | |||
<p>For deeper issues, you may need to run the custom task code in a Java debugger. First, get the source for Ant and build it with debugging information.</p> | |||
@@ -785,10 +762,7 @@ C:\tmp\anttests\MyFirstTask> | |||
<p>If you need to debug when a task attribute or the text is set, begin by debugging into method <code>execute()</code> of your custom task. Then set breakpoints in other methods. This will ensure the class byte-code has been loaded by the Java VM.</p> | |||
<a name="resources"></a> | |||
<h2>Resources</h2> | |||
<h2 id="resources">Resources</h2> | |||
<p>This tutorial and its resources are available via | |||
<a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=22570">BugZilla [6]</a>. | |||
The ZIP provided there contains</p><ul> | |||
@@ -805,15 +779,16 @@ The ZIP provided there contains</p><ul> | |||
<a href="tutorial-writing-tasks-src.zip">here [7]</a> inside the manual. | |||
</p> | |||
<p>Used Links:<br /> | |||
[1] <a href="http://ant.apache.org/manual/properties.html#built-in-props">http://ant.apache.org/manual/properties.html#built-in-props</a><br /> | |||
[2] <a href="http://ant.apache.org/manual/Tasks/taskdef.html">http://ant.apache.org/manual/Tasks/taskdef.html</a><br /> | |||
[3] <a href="http://ant.apache.org/manual/develop.html#set-magic">http://ant.apache.org/manual/develop.html#set-magic</a><br /> | |||
[4] <a href="http://ant.apache.org/manual/develop.html#nested-elements">http://ant.apache.org/manual/develop.html#nested-elements</a><br /> | |||
[5] <a href="http://gump.covalent.net/jars/latest/ant/ant-testutil.jar">http://gump.covalent.net/jars/latest/ant/ant-testutil.jar</a><br /> | |||
[6] <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=22570">http://issues.apache.org/bugzilla/show_bug.cgi?id=22570</a><br /> | |||
[7] <a href="tutorial-writing-tasks-src.zip">tutorial-writing-tasks-src.zip</a><br /> | |||
</p> | |||
<p>Used Links:</p> | |||
<ol class="refs"> | |||
<li><a href="http://ant.apache.org/manual/properties.html#built-in-props">http://ant.apache.org/manual/properties.html#built-in-props</a></li> | |||
<li><a href="http://ant.apache.org/manual/Tasks/taskdef.html">http://ant.apache.org/manual/Tasks/taskdef.html</a></li> | |||
<li><a href="http://ant.apache.org/manual/develop.html#set-magic">http://ant.apache.org/manual/develop.html#set-magic</a></li> | |||
<li><a href="http://ant.apache.org/manual/develop.html#nested-elements">http://ant.apache.org/manual/develop.html#nested-elements</a></li> | |||
<li><a href="http://gump.covalent.net/jars/latest/ant/ant-testutil.jar">http://gump.covalent.net/jars/latest/ant/ant-testutil.jar</a></li> | |||
<li><a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=22570">http://issues.apache.org/bugzilla/show_bug.cgi?id=22570</a></li> | |||
<li><a href="tutorial-writing-tasks-src.zip">tutorial-writing-tasks-src.zip</a></li> | |||
</ol> | |||
</body> | |||
</html> |
@@ -1,4 +1,4 @@ | |||
<!-- | |||
!<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
@@ -30,16 +30,14 @@ | |||
<h3>Tutorials</h3> | |||
<p><a href="tutorial-HelloWorldWithAnt.html">Hello World with Apache Ant</a><br/> | |||
A step by step tutorial for starting java programming with Ant.</p> | |||
A step by step tutorial for starting Java programming with Ant.</p> | |||
<p><a href="tutorial-writing-tasks.html">Writing Tasks</a><br/> | |||
A step by step tutorial for writing tasks.</p> | |||
<p><a href="tutorial-tasks-filesets-properties.html">Tasks using Properties, Filesets & Paths</a><br/> | |||
How to get and set properties and how to use nested filesets and paths | |||
How to get and set properties and how to use nested filesets and paths | |||
while writing tasks. Finally it explains how to contribute tasks to Ant.</p> | |||
</body> | |||
</html> |
@@ -24,16 +24,17 @@ | |||
<body> | |||
<h1>Using Apache Ant</h1> | |||
<h2><a name="buildfile">Writing a Simple Buildfile</a></h2> | |||
<h2 id="buildfile">Writing a Simple Buildfile</h2> | |||
<p>Apache Ant's buildfiles are written in XML. Each buildfile contains one project | |||
and at least one (default) target. Targets contain task elements. | |||
Each task element of the buildfile can have an <code>id</code> attribute and | |||
can later be referred to by the value supplied to this. The value has | |||
to be unique. (For additional information, see the | |||
<a href="#tasks"> Tasks</a> section below.)</p> | |||
<h3><a name="projects">Projects</a></h3> | |||
<h3 id="projects">Projects</h3> | |||
<p>A <i>project</i> has three attributes:</p> | |||
<table border="1" cellpadding="2" cellspacing="0"> | |||
<table> | |||
<tr> | |||
<td valign="top"><b>Attribute</b></td> | |||
<td valign="top"><b>Description</b></td> | |||
@@ -47,7 +48,7 @@ to be unique. (For additional information, see the | |||
<tr> | |||
<td valign="top">default</td> | |||
<td valign="top">the default target to use when no target is supplied.</td> | |||
<td align="center" valign="top">No; however, <b>since Ant 1.6.0</b>, | |||
<td align="center" valign="top">No; however, <em>since Ant 1.6.0</em>, | |||
every project includes an implicit target that contains any and | |||
all top-level tasks and/or types. This target will always be | |||
executed as part of the project's initialization, even when Ant is | |||
@@ -78,7 +79,7 @@ to be executed. When starting Ant, you can select which target(s) you | |||
want to have executed. When no target is given, | |||
the project's default is used.</p> | |||
<h3><a name="targets">Targets</a></h3> | |||
<h3 id="targets">Targets</h3> | |||
<p>A target can depend on other targets. You might have a target for compiling, | |||
for example, and a target for creating a distributable. You can only build a | |||
distributable when you have compiled first, so the distribute target | |||
@@ -92,7 +93,7 @@ executed if the dependent target(s) did not (need to) run. | |||
<p>More information can be found in the | |||
dedicated <a href="targets.html">manual page</a>.</p> | |||
<h3><a name="tasks">Tasks</a></h3> | |||
<h3 id="tasks">Tasks</h3> | |||
<p>A task is a piece of code that can be executed.</p> | |||
<p>A task can have multiple attributes (or arguments, if you prefer). The value | |||
of an attribute might contain references to a property. These references will be | |||
@@ -140,7 +141,7 @@ be backward-compatible with this behaviour, since there will likely be no | |||
task instances at all, only proxies. | |||
</p> | |||
<h3><a name="properties">Properties</a></h3> | |||
<h3 id="properties">Properties</h3> | |||
<p>Properties are an important way to customize a build process or | |||
to just provide shortcuts for strings that are used repeatedly | |||
@@ -163,7 +164,7 @@ task instances at all, only proxies. | |||
found <a href="properties.html">in the concepts section</a> of this | |||
manual.</p> | |||
<h3><a name="example">Example Buildfile</a></h3> | |||
<h3 id="example">Example Buildfile</h3> | |||
<pre> | |||
<project name="MyProject" default="dist" basedir="."> | |||
<description> | |||
@@ -205,8 +206,8 @@ task instances at all, only proxies. | |||
</project> | |||
</pre> | |||
<p>Notice that we are declaring properties outside any target. As of | |||
Ant 1.6 all tasks can be declared outside targets (earlier version | |||
<p>Notice that we are declaring properties outside any target. <em>Since | |||
Ant 1.6</em>, all tasks can be declared outside targets (earlier version | |||
only allowed <tt><property></tt>,<tt><typedef></tt> and | |||
<tt><taskdef></tt>). When you do this they are evaluated before | |||
any targets are executed. Some tasks will generate build failures if | |||
@@ -222,7 +223,7 @@ Finally, for this target to work the source in the <tt>src</tt> subdirectory | |||
should be stored in a directory tree which matches the package names. Check the | |||
<tt><javac></tt> task for details. | |||
<h3><a name="filters">Token Filters</a></h3> | |||
<h3 id="filters">Token Filters</h3> | |||
<p>A project can have a set of tokens that might be automatically expanded if | |||
found when a file is copied, when the filtering-copy behavior is selected in the | |||
tasks that support this. These might be set in the buildfile | |||
@@ -243,7 +244,7 @@ tokens, this should not cause problems.</p> | |||
<p><b>Warning:</b> If you copy binary files with filtering turned on, you can corrupt the | |||
files. This feature should be used with text files <em>only</em>.</p> | |||
<h3><a name="path">Path-like Structures</a></h3> | |||
<h3 id="path">Path-like Structures</h3> | |||
<p>You can specify <code>PATH</code>- and <code>CLASSPATH</code>-type | |||
references using both | |||
"<code>:</code>" and "<code>;</code>" as separator | |||
@@ -359,10 +360,10 @@ can be written as: | |||
<path id="base.path" path="${classpath}"/> | |||
</pre> | |||
<h4><a name="pathshortcut">Path Shortcut</a></h4> | |||
<h4 id="pathshortcut">Path Shortcut</h4> | |||
<p> | |||
In Ant 1.6 a shortcut for converting paths to OS specific strings | |||
in properties has been added. One can use the expression | |||
in properties has been added. One can use the expression | |||
${toString:<em>pathreference</em>} to convert a path element | |||
reference to a string that can be used for a path argument. | |||
For example: | |||
@@ -376,16 +377,15 @@ can be written as: | |||
</javac> | |||
</pre> | |||
<h3><a name="arg">Command-line Arguments</a></h3> | |||
<h3 id="arg">Command-line Arguments</h3> | |||
<p>Several tasks take arguments that will be passed to another | |||
process on the command line. To make it easier to specify arguments | |||
that contain space characters, nested <code>arg</code> elements can be used.</p> | |||
<table border="1" cellpadding="2" cellspacing="0"> | |||
<table> | |||
<tr> | |||
<td width="12%" valign="top"><b>Attribute</b></td> | |||
<td width="78%" valign="top"><b>Description</b></td> | |||
<td width="10%" valign="top"><b>Required</b></td> | |||
<td valign="top"><b>Attribute</b></td> | |||
<td valign="top"><b>Description</b></td> | |||
<td valign="top"><b>Required</b></td> | |||
</tr> | |||
<tr> | |||
<td valign="top">value</td> | |||
@@ -454,7 +454,7 @@ is very different from what you expect under some circumstances.</p> | |||
<code>\dir;\dir2;\dir3</code> on DOS-based systems and | |||
<code>/dir:/dir2:/dir3</code> on Unix-like systems.</p> | |||
<h3><a name="references">References</a></h3> | |||
<h3 id="references">References</h3> | |||
<p>Any project element can be assigned an identifier using its | |||
<code>id</code> attribute. In most cases the element can subsequently | |||
@@ -508,29 +508,28 @@ replicate the same snippet of XML over and over again--using a | |||
</target> | |||
</project> | |||
</pre></blockquote> | |||
<p>All tasks that use nested elements for | |||
<a href="Types/patternset.html">PatternSet</a>s, | |||
<a href="Types/fileset.html">FileSet</a>s, | |||
<a href="Types/zipfileset.html">ZipFileSet</a>s or | |||
<a href="#path">path-like structures</a> accept references to these structures | |||
as shown in the examples. Using <code>refid</code> on a task will ordinarily | |||
have the same effect (referencing a task already declared), but the user | |||
should be aware that the interpretation of this attribute is dependent on the | |||
implementation of the element upon which it is specified. Some tasks (the | |||
<a href="Tasks/property.html">property</a> task is a handy example) | |||
<p>All tasks that use nested elements for | |||
<a href="Types/patternset.html">PatternSet</a>s, | |||
<a href="Types/fileset.html">FileSet</a>s, | |||
<a href="Types/zipfileset.html">ZipFileSet</a>s or | |||
<a href="#path">path-like structures</a> accept references to these structures | |||
as shown in the examples. Using <code>refid</code> on a task will ordinarily | |||
have the same effect (referencing a task already declared), but the user | |||
should be aware that the interpretation of this attribute is dependent on the | |||
implementation of the element upon which it is specified. Some tasks (the | |||
<a href="Tasks/property.html">property</a> task is a handy example) | |||
deliberately assign a different meaning to <code>refid</code>.</p> | |||
<h3><a name="external-tasks">Use of external tasks</a></h3> | |||
Ant supports a plugin mechanism for using third party tasks. For using them you | |||
have to do two steps: | |||
<h3 id="external-tasks">Use of external tasks</h3> | |||
Ant supports a plugin mechanism for using third party tasks. For using them you | |||
have to do two steps: | |||
<ol> | |||
<li>place their implementation somewhere where Ant can find them</li> | |||
<li>declare them.</li> | |||
</ol> | |||
Don't add anything to the CLASSPATH environment variable - this is often the | |||
reason for very obscure errors. Use Ant's own <a href="install.html#optionalTasks">mechanisms</a> | |||
for adding libraries: | |||
</ol> | |||
Don't add anything to the CLASSPATH environment variable - this is often the | |||
reason for very obscure errors. Use Ant's own <a href="install.html#optionalTasks">mechanisms</a> | |||
for adding libraries: | |||
<ul> | |||
<li>via command line argument <code>-lib</code></li> | |||
<li>adding to <code>${user.home}/.ant/lib</code></li> | |||
@@ -538,29 +537,29 @@ for adding libraries: | |||
</ul> | |||
For the declaration there are several ways: | |||
<ul> | |||
<li>declare a single task per using instruction using | |||
<code><<a href="Tasks/taskdef.html">taskdef</a> name="taskname" | |||
<li>declare a single task per using instruction using | |||
<code><<a href="Tasks/taskdef.html">taskdef</a> name="taskname" | |||
classname="ImplementationClass"/></code> | |||
<br> | |||
<code><taskdef name="for" classname="net.sf.antcontrib.logic.For" /> | |||
<code><taskdef name="for" classname="net.sf.antcontrib.logic.For" /> | |||
<for ... /></code> | |||
</li> | |||
<li>declare a bundle of tasks using a properties-file holding these | |||
<li>declare a bundle of tasks using a properties-file holding these | |||
taskname-ImplementationClass-pairs and <code><taskdef></code> | |||
<br> | |||
<code><taskdef resource="net/sf/antcontrib/antcontrib.properties" /> | |||
<code><taskdef resource="net/sf/antcontrib/antcontrib.properties" /> | |||
<for ... /></code> | |||
</li> | |||
<li>declare a bundle of tasks using a <a href="Types/antlib.html">xml-file</a> holding these | |||
<li>declare a bundle of tasks using a <a href="Types/antlib.html">xml-file</a> holding these | |||
taskname-ImplementationClass-pairs and <code><taskdef></code> | |||
<br> | |||
<code><taskdef resource="net/sf/antcontrib/antlib.xml" /> | |||
<code><taskdef resource="net/sf/antcontrib/antlib.xml" /> | |||
<for ... /></code> | |||
</li> | |||
<li>declare a bundle of tasks using a xml-file named antlib.xml, XML-namespace and | |||
<a href="Types/antlib.html#antlibnamespace"><code>antlib:</code> protocol handler</a> | |||
<li>declare a bundle of tasks using a xml-file named antlib.xml, XML-namespace and | |||
<a href="Types/antlib.html#antlibnamespace"><code>antlib:</code> protocol handler</a> | |||
<br> | |||
<code><project xmlns:ac="antlib:net.sf.antcontrib"/> | |||
<code><project xmlns:ac="antlib:net.sf.antcontrib"/> | |||
<ac:for ... /></code> | |||
</li> | |||
</ul> | |||
@@ -569,7 +568,7 @@ If you need a special function, you should | |||
<ol> | |||
<li>have a look at this manual, because Ant provides lot of tasks</li> | |||
<li>have a look at the external task page <a href="http://ant.apache.org/external.html">online</a></li> | |||
<li>have a look at the external task <a href="http://wiki.apache.org/ant/AntExternalTaskdefs">wiki | |||
<li>have a look at the external task <a href="http://wiki.apache.org/ant/AntExternalTaskdefs">wiki | |||
page</a></li> | |||
<li>ask on the <a href="http://ant.apache.org/mail.html#User%20List">Ant user</a> list</li> | |||
<li><a href="tutorial-writing-tasks.html">implement </a>(and share) your own</li> | |||
@@ -47,4 +47,3 @@ | |||
</ul> | |||
</body> | |||
</html> | |||