@@ -165,15 +165,12 @@
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<strong>Using Ant </strong>
<strong>How do I ... </strong>
</font>
</td></tr>
<tr><td>
<blockquote>
<ul>
<li><a href="#always-recompiles">
Why does Ant always recompile all my Java files?
</a></li>
<li><a href="#passing-cli-args">
How do I pass parameters from the command line to my
build file?
@@ -191,17 +188,36 @@
</a></li>
<li><a href="#batch-shell-execute">
How do I execute a batch file or shell script from Ant?
</a></li>
<li><a href="#defaultexcludes">
I've used a <code><delete></code> task to delete
unwanted
SourceSafe control files (CVS files, editor backup files, etc.), but
it doesn't seem to work; the files never get deleted. What's
wrong?
</a></li>
<li><a href="#multi-conditions">
I want to execute a particular target only if
multiple conditions are true.
</a></li>
<li><a href="#encoding">
How can I include national characters like German
umlauts in my build file?
</a></li>
</ul>
</blockquote>
</td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<strong>It doesn't work (as expected)</strong>
</font>
</td></tr>
<tr><td>
<blockquote>
<ul>
<li><a href="#always-recompiles">
Why does Ant always recompile all my Java files?
</a></li>
<li><a href="#defaultexcludes">
I've used a <code><delete></code> task to
delete unwanted SourceSafe control files (CVS files, editor
backup files, etc.), but it doesn't seem to work; the files
never get deleted. What's wrong?
</a></li>
<li><a href="#stop-dependency">
I have a target I want to skip if a property is set,
@@ -215,16 +231,17 @@
<code><include></code> of just the files I want, but it
isn't giving me any files at all. What's wrong?
</a></li>
<li><a href="#encoding">
How can I include national characters like German
umlauts in my build file?
</a></li>
<li><a href="#properties-not-trimmed">
<code>ant</code> failed to build my program via javac
even when I put the needed jars in an external
<code>build.properties</code> file and reference them by
<code>pathelement</code> or <code>classpath refid</code>.
</a></li>
<li><a href="#winzip-lies">
Ant creates WAR files with a lower-case
<code>web-inf</code> or JAR files with a lower-case
<code>meta-inf</code> directory.
</a></li>
</ul>
</blockquote>
@@ -613,46 +630,7 @@
</td></tr>
</table>
</a>
<a name="always-recompiles">
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<strong>
Why does Ant always recompile all my Java files?
</strong>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>In order to find out which files should be compiled, Ant
compares the timestamps of the source files to those of the
resulting <code>.class</code> files. Opening all source files
to find out which package they belong to would be very
inefficient. Instead, Ant expects you to place your
source files in a directory hierarchy that mirrors your
package hierarchy and to point Ant to the root of this
directory tree with the <code>srcdir</code> attribute.</p>
<p>Say you have <code><javac srcdir="src"
destdir="dest"/></code>. If Ant finds a file
<code>src/a/b/C.java</code>, it expects it to be in package
<code>a.b</code> so that the resulting <code>.class</code>
file is going to be <code>dest/a/b/C.class</code>.</p>
<p>If your source-tree directory structure does not match your
package structure, Ant's heuristic won't work, and
it will recompile classes that are up-to-date. Ant is not the
only tool that expects a source-tree layout like this.</p>
<p>If you have Java source files that aren't declared to
be part of any package, you can still use the <code><javac></code>
task to compile these files correctly - just set the
<code>srcdir</code> and <code>destdir</code> attributes to
the actual directory the source
files live in and the directory the class files should go into,
respectively.</p>
</blockquote>
</td></tr>
</table>
</a>
<a name="passing-cli-args">
<a name="passing-cli-args">
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
@@ -986,81 +964,6 @@ shell-prompt> cat < foo
</blockquote>
</td></tr>
</table>
</a>
<a name="defaultexcludes">
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<strong>
I've used a <code><delete></code> task to delete
unwanted
SourceSafe control files (CVS files, editor backup files, etc.), but
it doesn't seem to work; the files never get deleted. What's
wrong?
</strong>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>This is probably happening because, by default, Ant excludes
SourceSafe control files (<code>vssver.scc</code>) and certain other
files from FileSets.</p>
<p>Here's what you probably did:</p>
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
<delete>
<fileset dir="${build.src}" includes="**/vssver.scc"/>
</delete>
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
<p>You need to switch off the default exclusions,
and it will work:</p>
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
<delete>
<fileset dir="${build.src}" includes="**/vssver.scc"
defaultexcludes="no"/>
</delete>
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
<p>For a complete listing of the patterns that are excluded
by default, see <a href="manual/dirtasks.html#defaultexcludes">the user
manual</a>.</p>
</blockquote>
</td></tr>
</table>
</a>
<a name="multi-conditions">
<table border="0" cellspacing="0" cellpadding="2" width="100%">
@@ -1231,6 +1134,164 @@ shell-prompt> cat < foo
</blockquote>
</td></tr>
</table>
</a>
<a name="encoding">
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<strong>
How can I include national characters like German
umlauts in my build file?
</strong>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>You need to tell the XML parser which character encoding
your build file uses, this is done inside the <a href="http://www.w3.org/TR/2000/REC-xml-20001006#sec-prolog-dtd">XML
declaration</a>.</p>
<p>By default the parser assumes you are using the UTF-8
encoding instead of your platform's default. For most Western
European countries you should set the encoding to
<code>ISO-8859-1</code>. To do so, make the very first line
of you build file read like</p>
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
<?xml version="1.0" encoding="ISO-8859-1" ?>
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
</blockquote>
</td></tr>
</table>
</a>
<a name="always-recompiles">
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<strong>
Why does Ant always recompile all my Java files?
</strong>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>In order to find out which files should be compiled, Ant
compares the timestamps of the source files to those of the
resulting <code>.class</code> files. Opening all source files
to find out which package they belong to would be very
inefficient. Instead, Ant expects you to place your
source files in a directory hierarchy that mirrors your
package hierarchy and to point Ant to the root of this
directory tree with the <code>srcdir</code> attribute.</p>
<p>Say you have <code><javac srcdir="src"
destdir="dest"/></code>. If Ant finds a file
<code>src/a/b/C.java</code>, it expects it to be in package
<code>a.b</code> so that the resulting <code>.class</code>
file is going to be <code>dest/a/b/C.class</code>.</p>
<p>If your source-tree directory structure does not match your
package structure, Ant's heuristic won't work, and
it will recompile classes that are up-to-date. Ant is not the
only tool that expects a source-tree layout like this.</p>
<p>If you have Java source files that aren't declared to
be part of any package, you can still use the <code><javac></code>
task to compile these files correctly - just set the
<code>srcdir</code> and <code>destdir</code> attributes to
the actual directory the source
files live in and the directory the class files should go into,
respectively.</p>
</blockquote>
</td></tr>
</table>
</a>
<a name="defaultexcludes">
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<strong>
I've used a <code><delete></code> task to
delete unwanted SourceSafe control files (CVS files, editor
backup files, etc.), but it doesn't seem to work; the files
never get deleted. What's wrong?
</strong>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>This is probably happening because, by default, Ant excludes
SourceSafe control files (<code>vssver.scc</code>) and certain other
files from FileSets.</p>
<p>Here's what you probably did:</p>
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
<delete>
<fileset dir="${build.src}" includes="**/vssver.scc"/>
</delete>
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
<p>You need to switch off the default exclusions,
and it will work:</p>
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
<delete>
<fileset dir="${build.src}" includes="**/vssver.scc"
defaultexcludes="no"/>
</delete>
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
<p>For a complete listing of the patterns that are excluded
by default, see <a href="manual/dirtasks.html#defaultexcludes">the user
manual</a>.</p>
</blockquote>
</td></tr>
</table>
</a>
<a name="stop-dependency">
<table border="0" cellspacing="0" cellpadding="2" width="100%">
@@ -1293,78 +1354,58 @@ shell-prompt> cat < foo
<p>To get the files you want, focus on just the
<code><include></code> patterns that would be necessary
to get them. If you find you need to trim the list that the
<code><include></code> elements
produce, then use <code><exclude></code> elements.</p>
<code><include></code> elements produce, then use
<code><exclude></code> elements.</p>
</blockquote>
</td></tr>
</table>
</a>
<a name="enc oding ">
<a name="prop erties- not-trimme d">
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<strong>
How can I include national characters like German
umlauts in my build file?
<code>ant</code> failed to build my program via javac
even when I put the needed jars in an external
<code>build.properties</code> file and reference them by
<code>pathelement</code> or <code>classpath refid</code>.
</strong>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>You need to tell the XML parser which character encoding
your build file uses, this is done inside the <a href="http://www.w3.org/TR/2000/REC-xml-20001006#sec-prolog-dtd">XML
declaration</a>.</p>
<p>By default the parser assumes you are using the UTF-8
encoding instead of your platform's default. For most Western
European countries you should set the encoding to
<code>ISO-8859-1</code>. To do so, make the very first line
of you build file read like</p>
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
<?xml version="1.0" encoding="ISO-8859-1" ?>
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
<p>When <code>ant</code> loads properties from an external
file it dosn't touch the value of properties, trailing blanks
will not be trimmed for example.</p>
<p>If the value represents a file path, like a jar needed to
compile, the task which requires the value, javac for example
would fail to compile since it can't find the file due to
trailing spaces.</p>
</blockquote>
</td></tr>
</table>
</a>
<a name="properties-not-trimmed ">
<a name="winzip-lies">
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<strong>
<code>ant</code> failed to build my program via javac
even when I put the needed jars in an external
<code>build.properties</code> file and reference them by
<code>pathelement</code> or <code>classpath refid</code>.
Ant creates WAR files with a lower-case
<code>web-inf</code> or JAR files with a lower-case
<code>meta-inf</code> directory.
</strong>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>When <code>ant</code> loads properties from an external
file it dosn't touch the value of properties, trailing blanks
will not be trimmed for example.</p>
<p>If the value represents a file path, like a jar needed to
compile, the task which requires the value, javac for example
would fail to compile since it can't find the file due to
trailing spaces.</p>
<p>No it doesn't.</p>
<p>You may have seen these lower-case directory names in
WinZIP, but WinZIP is trying to be helpful (and fails). If
WinZIP encounters a filename that is all upper-case, it
assumes it has come from an old DOS box andchanges the case to
all lower-case for you.</p>
<p>If you extract (or just check) the archive with jar, you
will see that the names have the correct case.</p>
</blockquote>
</td></tr>
</table>