bodewig 2002/10/31 05:34:48
Modified: docs faq.html
xdocs faq.xml
Log:
Split "Using Ant section".
Add FAQ about WinZIP, file name case, <war> and WEB-INF as well as
<jar> and META-INF.
Revision Changes Path
1.41 +217 -176 jakarta-ant/docs/faq.html
Index: faq.html
===================================================================
RCS file: /home/cvs/jakarta-ant/docs/faq.html,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- faq.html 4 Oct 2002 08:32:13 -0000 1.40
+++ faq.html 31 Oct 2002 13:34:47 -0000 1.41
@@ -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?
@@ -192,17 +189,36 @@
<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,
so I have <code>unless="property"</code> as an attribute
@@ -216,16 +232,17 @@
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>
</td></tr>
@@ -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">
@@ -987,81 +965,6 @@
</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%">
<tr><td bgcolor="#828DA6">
@@ -1232,6 +1135,164 @@
</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%">
<tr><td bgcolor="#828DA6">
@@ -1293,78 +1354,58 @@
<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="encoding">
+ <a name="properties-not-trimmed">
<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>
1.25 +118 -98 jakarta-ant/xdocs/faq.xml
Index: faq.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/xdocs/faq.xml,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- faq.xml 3 Oct 2002 14:37:00 -0000 1.24
+++ faq.xml 31 Oct 2002 13:34:48 -0000 1.25
@@ -179,42 +179,7 @@
</faq>
</faqsection>
- <faqsection title="Using Ant">
- <faq id="always-recompiles">
- <question>Why does Ant always recompile all my Java files?</question>
- <answer>
-
- <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>
-
- </answer>
- </faq>
-
+ <faqsection title="How do I ...">
<faq id="passing-cli-args">
<question>How do I pass parameters from the command line to my
build file?</question>
@@ -363,44 +328,6 @@
</answer>
</faq>
- <faq id="defaultexcludes">
-
- <question>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?</question>
-
- <answer>
- <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>
-
-
- <source><![CDATA[
-<delete>
- <fileset dir="${build.src}" includes="**/vssver.scc"/>
-</delete>
-]]></source>
-
- <p>You need to switch off the default exclusions,
- and it will work:</p>
- <source><![CDATA[
-<delete>
- <fileset dir="${build.src}" includes="**/vssver.scc"
- defaultexcludes="no"/>
-</delete>
-]]></source>
-
- <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>
-
- </answer>
- </faq>
-
<faq id="multi-conditions">
<question>I want to execute a particular target only if
multiple conditions are true.</question>
@@ -523,6 +450,102 @@
</answer>
</faq>
+ <faq id="encoding">
+ <question>How can I include national characters like German
+ umlauts in my build file?</question>
+
+ <answer>
+ <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>
+
+ <source><![CDATA[
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+]]></source>
+ </answer>
+ </faq>
+ </faqsection>
+
+ <faqsection title="It doesn't work (as expected)">
+ <faq id="always-recompiles">
+ <question>Why does Ant always recompile all my Java files?</question>
+ <answer>
+
+ <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>
+
+ </answer>
+ </faq>
+
+ <faq id="defaultexcludes">
+
+ <question>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?</question>
+
+ <answer>
+ <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>
+
+
+ <source><![CDATA[
+<delete>
+ <fileset dir="${build.src}" includes="**/vssver.scc"/>
+</delete>
+]]></source>
+
+ <p>You need to switch off the default exclusions,
+ and it will work:</p>
+ <source><![CDATA[
+<delete>
+ <fileset dir="${build.src}" includes="**/vssver.scc"
+ defaultexcludes="no"/>
+</delete>
+]]></source>
+
+ <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>
+
+ </answer>
+ </faq>
+
<faq id="stop-dependency">
<question>I have a target I want to skip if a property is set,
so I have <code>unless="property"</code> as an attribute
@@ -573,33 +596,11 @@
<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>
</answer>
</faq>
- <faq id="encoding">
- <question>How can I include national characters like German
- umlauts in my build file?</question>
-
- <answer>
- <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>
-
- <source><![CDATA[
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-]]></source>
- </answer>
- </faq>
-
<faq id="properties-not-trimmed">
<question><code>ant</code> failed to build my program via javac
even when I put the needed jars in an external
@@ -616,6 +617,25 @@
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>
+ </answer>
+ </faq>
+
+ <faq id="winzip-lies">
+ <question>Ant creates WAR files with a lower-case
+ <code>web-inf</code> or JAR files with a lower-case
+ <code>meta-inf</code> directory.</question>
+
+ <answer>
+ <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>
</answer>
</faq>
</faqsection>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>