2006-09-11 04:19:00 +00:00
|
|
|
<!--
|
|
|
|
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.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
2001-04-10 07:06:37 +00:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="stylesheets/style.css">
|
2002-02-04 20:57:49 +00:00
|
|
|
<title>Running Apache Ant</title>
|
2001-04-10 07:06:37 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2010-11-11 17:04:16 +00:00
|
|
|
<h1>Running Apache Ant</h1>
|
2018-02-08 22:52:33 +01:00
|
|
|
<h2 id="commandline">Command Line</h2>
|
2001-04-10 07:06:37 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<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 <code>ant</code>.</p>
|
|
|
|
|
|
|
|
<p>When no arguments are specified, Ant looks for
|
|
|
|
a <samp>build.xml</samp> file in the current directory and, if found,
|
|
|
|
uses that file as the build file and runs the target specified in
|
|
|
|
the <var>default</var> attribute of the <code><project></code>
|
|
|
|
tag. To make Ant use a build file other than <samp>build.xml</samp>,
|
|
|
|
use the command-line option <code>-buildfile <em>file</em></code>,
|
|
|
|
where <em>file</em> is the name of the build file you want to use (or
|
|
|
|
a directory containing a <samp>build.xml</samp> file).</p>
|
|
|
|
|
|
|
|
<p>If you use the <code>-find [<em>file</em>]</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 called <samp>build.xml</samp>. To have it search for a
|
|
|
|
build file other than <samp>build.xml</samp>, specify a file
|
|
|
|
argument. <strong>Note</strong>: If you include any other flags or
|
|
|
|
arguments on the command line after 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 <samp>build.xml</samp>.</p>
|
|
|
|
|
|
|
|
<p>You can also set <a href="using.html#properties">properties</a> on
|
|
|
|
the command line. This can be done with
|
|
|
|
the <code>-D<i>property</i>=<i>value</i></code> option,
|
|
|
|
where <em>property</em> is the name of the property,
|
|
|
|
and <em>value</em> is the value for that property. If you specify a
|
|
|
|
property that is also set in the build file (see
|
|
|
|
the <a href="Tasks/property.html">property</a> task), the value
|
|
|
|
specified on the 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 <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 <a href="Tasks/property.html">property</a>
|
|
|
|
task's <var>environment</var> attribute.</p>
|
|
|
|
|
|
|
|
<p>Options that affect the amount of logging output by Ant
|
|
|
|
are: <code>-quiet</code>, which instructs Ant to print less
|
|
|
|
information to the console; <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 <code>-silent</code> which makes Ant print nothing but task output
|
|
|
|
and build failures (useful to capture Ant output by scripts).</p>
|
|
|
|
|
|
|
|
<p>It is also possible to specify one or more targets that should be
|
|
|
|
executed. When omitted, the target that is specified in
|
|
|
|
the <var>default</var> attribute of
|
|
|
|
the <a href="using.html#projects"><code>project</code></a> tag is
|
2001-04-10 07:06:37 +00:00
|
|
|
used.</p>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>The <code>-projecthelp</code> option prints out a list of the build
|
|
|
|
file's targets. Targets that include a <var>description</var>
|
|
|
|
attribute are listed as "Main targets", those without
|
|
|
|
a <var>description</var> are listed as "Other targets", then
|
|
|
|
the "Default" target is listed ("Other targets" are only
|
|
|
|
displayed if there are no main targets, or if Ant is invoked
|
|
|
|
in <code>-verbose</code> or <code>-debug</code> mode).</p>
|
2001-04-10 07:06:37 +00:00
|
|
|
|
2018-02-08 22:52:33 +01:00
|
|
|
<h3 id="options">Command-line Options Summary</h3>
|
2001-04-10 07:06:37 +00:00
|
|
|
<pre>ant [options] [target [target2 [target3] ...]]
|
|
|
|
Options:
|
2014-07-20 10:17:46 +03:00
|
|
|
-help, -h print this message and exit
|
|
|
|
-projecthelp, -p print project help information and exit
|
2002-02-01 22:29:21 +00:00
|
|
|
-version print the version information and exit
|
2002-09-02 12:29:38 +00:00
|
|
|
-diagnostics print information that might be helpful to
|
2014-07-20 10:17:46 +03:00
|
|
|
diagnose or report problems and exit
|
2002-09-02 12:29:38 +00:00
|
|
|
-quiet, -q be extra quiet
|
2012-08-15 11:13:15 +00:00
|
|
|
-silent, -S print nothing but task outputs and build failures
|
2002-09-02 12:29:38 +00:00
|
|
|
-verbose, -v be extra verbose
|
2003-10-03 01:40:48 +00:00
|
|
|
-debug, -d print debugging information
|
|
|
|
-emacs, -e produce logging information without adornments
|
|
|
|
-lib <path> specifies a path to search for jars and classes
|
2002-09-02 12:29:38 +00:00
|
|
|
-logfile <file> use given file for log
|
|
|
|
-l <file> ''
|
|
|
|
-logger <classname> the class which is to perform logging
|
|
|
|
-listener <classname> add an instance of class as a project listener
|
2003-10-03 01:40:48 +00:00
|
|
|
-noinput do not allow interactive input
|
2002-09-02 12:29:38 +00:00
|
|
|
-buildfile <file> use given buildfile
|
|
|
|
-file <file> ''
|
|
|
|
-f <file> ''
|
2002-09-03 15:24:08 +00:00
|
|
|
-D<property>=<value> use value for given property
|
2003-07-16 14:14:38 +00:00
|
|
|
-keep-going, -k execute all targets that do not depend
|
|
|
|
on failed target(s)
|
2002-09-02 12:29:38 +00:00
|
|
|
-propertyfile <name> load all properties from file with -D
|
|
|
|
properties taking precedence
|
|
|
|
-inputhandler <class> the class which will handle input requests
|
2003-10-03 01:40:48 +00:00
|
|
|
-find <file> (s)earch for buildfile towards the root of
|
|
|
|
-s <file> the filesystem and use it
|
|
|
|
-nice number A niceness value for the main thread:
|
2003-11-28 11:56:29 +00:00
|
|
|
1 (lowest) to 10 (highest); 5 is the default
|
2005-01-13 23:09:32 +00:00
|
|
|
-nouserlib Run ant without using the jar files from ${user.home}/.ant/lib
|
2006-04-13 17:36:55 +00:00
|
|
|
-noclasspath Run ant without using CLASSPATH
|
2018-02-28 07:58:59 +01:00
|
|
|
-autoproxy Java 5+ : use the OS proxies
|
2006-10-16 14:05:44 +00:00
|
|
|
-main <class> override Ant's normal entry point
|
2001-04-10 07:06:37 +00:00
|
|
|
</pre>
|
2001-12-14 12:23:50 +00:00
|
|
|
<p>For more information about <code>-logger</code> and
|
2002-06-22 23:38:38 +00:00
|
|
|
<code>-listener</code> see
|
|
|
|
<a href="listeners.html">Loggers & Listeners</a>.
|
|
|
|
<p>For more information about <code>-inputhandler</code> see
|
|
|
|
<a href="inputhandler.html">InputHandler</a>.
|
2018-02-08 22:52:33 +01:00
|
|
|
<p>Easiest way of changing the exit-behaviour is subclassing the original main class:</p>
|
2006-10-16 13:57:50 +00:00
|
|
|
<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
|
|
|
|
}
|
|
|
|
}
|
2018-02-08 22:52:33 +01:00
|
|
|
</pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>and starting Ant with access (<code>-lib <i>path-to-class</i></code>) to this class.</p>
|
2002-06-22 23:38:38 +00:00
|
|
|
|
2018-02-08 22:52:33 +01:00
|
|
|
<h3 id="libs">Library Directories</h3>
|
2003-10-02 06:44:27 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Prior to Ant 1.6, all jars in the <samp>ANT_HOME/lib</samp> would
|
|
|
|
be added to the <samp>CLASSPATH</samp> 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 <samp>ANT_HOME/lib</samp> and a user specific
|
|
|
|
directory, <samp>${user.home}/.ant/lib</samp>. This arrangement allows
|
|
|
|
the Ant installation to be shared by many users while still allowing
|
|
|
|
each user to deploy additional jars. Such additional jars could be
|
|
|
|
support jars for Ant's optional tasks or jars containing third-party
|
|
|
|
tasks to be used in the build. It also allows the main Ant
|
|
|
|
installation to be locked down which will please system
|
|
|
|
administrators.</p>
|
|
|
|
|
|
|
|
<p>Additional directories to be searched may be added by using
|
|
|
|
the <code>-lib</code> option. The <code>-lib</code> option specifies
|
|
|
|
a search path. Any jars or classes in the directories of the path will
|
|
|
|
be added to Ant's classloader. The order in which jars are added to
|
|
|
|
the classpath is as follows:</p>
|
2003-10-02 06:44:27 +00:00
|
|
|
|
|
|
|
<ul>
|
2018-02-28 07:58:59 +01:00
|
|
|
<li><code>-lib</code> jars in the order specified by the <code>-lib</code> options on the command line</li>
|
|
|
|
<li>jars from <samp>${user.home}/.ant/lib</samp> (unless <code>-nouserlib</code> is set)</li>
|
|
|
|
<li>jars from <samp>ANT_HOME/lib</samp></li>
|
2003-10-02 06:44:27 +00:00
|
|
|
</ul>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Note that the <code>CLASSPATH</code> environment variable is passed
|
|
|
|
to Ant using a <code>-lib</code> option. Ant itself is started with a
|
|
|
|
very minimalistic classpath. Ant should work perfectly well with an
|
|
|
|
empty <code>CLASSPATH</code> environment variable, something the
|
|
|
|
the <code>-noclasspath</code> option actually enforces. We get many
|
|
|
|
more support calls related to classpath problems (especially quoting
|
|
|
|
problems) than we like.</p>
|
|
|
|
|
|
|
|
<p>The location of <samp>${user.home}/.ant/lib</samp> is somewhat
|
|
|
|
dependent on the JVM. On Unix systems <samp>${user.home}</samp> maps
|
|
|
|
to the user's home directory whilst on recent versions of Windows it
|
|
|
|
will be somewhere such
|
|
|
|
as <code>C:\Users\<i>username</i>\.ant\lib</code>. You should consult
|
|
|
|
your JVM documentation for more details.</p>
|
2003-10-02 06:44:27 +00:00
|
|
|
|
2001-04-10 07:06:37 +00:00
|
|
|
<h3>Examples</h3>
|
2018-02-09 06:54:03 +01:00
|
|
|
|
|
|
|
<pre>ant</pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>runs Ant using the <samp>build.xml</samp> file in the current
|
|
|
|
directory, on the default target.</p>
|
2009-04-21 09:17:21 +00:00
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>ant -buildfile test.xml</pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>runs Ant using the <samp>test.xml</samp> file in the current
|
|
|
|
directory, on the default target.</p>
|
2009-04-21 09:17:21 +00:00
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>ant -buildfile test.xml dist</pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>runs Ant using the <samp>test.xml</samp> file in the current
|
|
|
|
directory, on the target called <samp>dist</samp>.</p>
|
2009-04-21 09:17:21 +00:00
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>ant -buildfile test.xml -Dbuild=build/classes dist</pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>runs Ant using the <samp>test.xml</samp> file in the current
|
|
|
|
directory, on the target called <samp>dist</samp>, setting
|
|
|
|
the <code>build</code> property to the
|
|
|
|
value <samp>build/classes</samp>.</p>
|
2001-04-10 07:06:37 +00:00
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>ant -lib /home/ant/extras</pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>runs Ant picking up additional task and support jars from
|
|
|
|
the <samp>/home/ant/extras</samp> location</p>
|
2009-04-21 09:17:21 +00:00
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>ant -lib one.jar;another.jar</pre>
|
|
|
|
<pre>ant -lib one.jar -lib another.jar</pre>
|
2009-04-21 09:17:21 +00:00
|
|
|
<p>adds two jars to Ants classpath.</p>
|
|
|
|
|
2018-02-08 22:52:33 +01:00
|
|
|
<h3 id="files">Files</h3>
|
2001-06-13 15:29:47 +00:00
|
|
|
|
|
|
|
<p>The Ant wrapper script for Unix will source (read and evaluate) the
|
2018-02-28 07:58:59 +01:00
|
|
|
file <samp>~/.antrc</samp> before it does anything. On Windows, the
|
|
|
|
Ant wrapper batch-file invokes <samp>%HOME%\antrc_pre.bat</samp> at
|
|
|
|
the start and <samp>%HOME%\antrc_post.bat</samp> at the end. You can
|
|
|
|
use these 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>
|
2001-06-13 15:29:47 +00:00
|
|
|
|
2018-02-08 22:52:33 +01:00
|
|
|
<h3 id="envvars">Environment Variables</h3>
|
2001-06-13 15:29:47 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>The wrapper scripts use the following environment variables (if set):</p>
|
2001-06-13 15:29:47 +00:00
|
|
|
|
|
|
|
<ul>
|
2018-02-28 07:58:59 +01:00
|
|
|
<li><code>JAVACMD</code>—full path of the Java executable. Use this
|
|
|
|
to invoke a different JVM than <samp>JAVA_HOME/bin/java(.exe)</samp>.</li>
|
2001-06-13 15:29:47 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<li><code>ANT_OPTS</code>—command-line arguments that should be
|
2002-04-25 00:38:12 +00:00
|
|
|
passed to the JVM. For example, you can define system properties or set
|
2001-06-13 15:29:47 +00:00
|
|
|
the maximum Java heap size here.</li>
|
2001-10-17 00:27:34 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<li><code>ANT_ARGS</code>—Ant command-line arguments. For example,
|
2002-06-22 23:38:38 +00:00
|
|
|
set <code>ANT_ARGS</code> to point to a different logger, include a
|
2018-02-08 22:52:33 +01:00
|
|
|
listener, and to include the <code>-find</code> flag.<br/>
|
2018-02-28 07:58:59 +01:00
|
|
|
<strong>Note</strong>: If you include <code>-find</code>
|
2002-06-22 23:38:38 +00:00
|
|
|
in <code>ANT_ARGS</code>, you should include the name of the build file
|
2018-02-28 07:58:59 +01:00
|
|
|
to find, even if the file is called <samp>build.xml</samp>.</li>
|
2001-06-13 15:29:47 +00:00
|
|
|
</ul>
|
|
|
|
|
2018-02-08 22:52:33 +01:00
|
|
|
<h3 id="sysprops">Java System Properties</h3>
|
2005-05-09 15:36:39 +00:00
|
|
|
<p>Some of Ant's core classes can be configured via system properties.</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<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</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>grep -r -n "getPropert" * > ..\grep.txt</pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>command. After that I filtered out the often-used but
|
|
|
|
not-so-important values (most of them read-only
|
|
|
|
values): <code>path.separator</code>, <code>ant.home</code>, <code>basedir</code>, <code>user.dir</code>, <code>os.name</code>, <code>line.separator</code>, <code>java.home</code>, <code>java.version</code>, <code>java.version</code>, <code>user.home</code>, <code>java.class.path</code><br/>
|
|
|
|
And I filtered out the <code>getPropertyHelper</code> access.</p>
|
|
|
|
|
2018-02-08 22:52:33 +01:00
|
|
|
<table>
|
2003-12-03 11:25:04 +00:00
|
|
|
<tr>
|
|
|
|
<th>property name</th>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>valid values/default value</th>
|
2003-12-03 11:25:04 +00:00
|
|
|
<th>description</th>
|
|
|
|
</tr>
|
2006-04-11 18:51:20 +00:00
|
|
|
<tr>
|
|
|
|
<td><code>ant.build.javac.source</code></td>
|
|
|
|
<td>Source-level version number</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>Default <var>source</var> value for <javac>/<javadoc></td>
|
2006-04-11 18:51:20 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>ant.build.javac.target</code></td>
|
|
|
|
<td>Class-compatibility version number</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>Default <var>target</var> value for <javac></td>
|
2006-04-11 18:51:20 +00:00
|
|
|
</tr>
|
2004-08-31 22:32:53 +00:00
|
|
|
<tr>
|
|
|
|
<td><code>ant.executor.class</code></td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>classname; default is <q>org.<wbr>apache.<wbr>tools.<wbr>ant.<wbr>helper.<wbr>DefaultExecutor</q></td>
|
2018-02-08 22:52:33 +01:00
|
|
|
<td><em>Since Ant 1.6.3</em> Ant will delegate Target invocation to the
|
2018-02-28 07:58:59 +01:00
|
|
|
<code>org.apache.tools.ant.Executor</code> implementation specified here.
|
2004-08-31 22:32:53 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
2018-02-08 22:52:33 +01:00
|
|
|
<tr>
|
2005-01-13 23:09:32 +00:00
|
|
|
<td><code>ant.file</code></td>
|
|
|
|
<td>read only: full filename of the build file</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>This is set to the name of the build
|
|
|
|
file. In <a href="Tasks/import.html"><import>-ed</a> files,
|
|
|
|
this is set to the containing build file.
|
2005-01-13 23:09:32 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
2018-02-08 22:52:33 +01:00
|
|
|
<tr>
|
2005-01-13 23:09:32 +00:00
|
|
|
<td><code>ant.file.*</code></td>
|
|
|
|
<td>read only: full filename of the build file of Ant projects
|
|
|
|
</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>This is set to the name of a file by project; this lets you
|
|
|
|
determine the location
|
|
|
|
of <a href="Tasks/import.html"><import>-ed</a> files,
|
2005-01-13 23:09:32 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
2018-02-08 22:52:33 +01:00
|
|
|
<tr>
|
2003-12-03 11:25:04 +00:00
|
|
|
<td><code>ant.input.properties</code></td>
|
|
|
|
<td>filename (required)</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>Name of the file holding the values for
|
|
|
|
the <a href="inputhandler.html">PropertyFileInputHandler</a>.
|
2003-12-03 11:25:04 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>ant.logger.defaults</code></td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>filename (optional, default <q>/org/<wbr>apache/<wbr>tools/<wbr>ant/<wbr>listener/<wbr>defaults.properties</q>)</td>
|
|
|
|
<td>Name of the file holding the color mappings for
|
|
|
|
the <a href="listeners.html#AnsiColorLogger">AnsiColorLogger</a>.
|
2003-12-03 11:25:04 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>ant.netrexxc.*</code></td>
|
|
|
|
<td>several formats</td>
|
2010-05-26 20:33:51 +00:00
|
|
|
<td>Use specified values as defaults for <a href="Tasks/netrexxc.html">netrexxc</a>.
|
2003-12-03 11:25:04 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>ant.PropertyHelper</code></td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>Ant reference name (optional)</td>
|
|
|
|
<td>Specify the PropertyHelper to use. The object must be of the
|
|
|
|
type <code>org.apache.tools.ant.PropertyHelper</code>. By default,
|
|
|
|
an object of <code>org.apache.tools.ant.PropertyHelper</code> will
|
|
|
|
be used as PropertyHelper.
|
2003-12-03 11:25:04 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>ant.regexp.regexpimpl</code></td>
|
|
|
|
<td>classname</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>classname for a RegExp implementation; by default, JDK 1.4+
|
|
|
|
implementation; <a href="Types/mapper.html#regexp-mapper">RegExp
|
|
|
|
Mapper</a> "Choice of regular expression implementation".
|
2003-12-03 11:25:04 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>ant.reuse.loader</code></td>
|
|
|
|
<td>boolean</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>allow to reuse classloaders used
|
|
|
|
in <code>org.apache.tools.ant.util.ClasspathUtil</code>.
|
2003-12-03 11:25:04 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>ant.XmlLogger.stylesheet.uri</code></td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>filename (default <q>log.xsl</q>)</td>
|
|
|
|
<td>Name for the stylesheet to include in the logfile
|
|
|
|
by <a href="listeners.html#XmlLogger">XmlLogger</a>.
|
2003-12-03 11:25:04 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>build.compiler</code></td>
|
|
|
|
<td>name</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>Specify the default compiler to use;
|
|
|
|
see <a href="Tasks/javac.html">javac</a>, <a href="Tasks/ejb.html#ejbjar_weblogic">EJB
|
|
|
|
Tasks</a> (<var>compiler</var>
|
|
|
|
attribute), <a href="Tasks/javah.html">javah</a>.
|
2003-12-03 11:25:04 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>build.compiler.emacs</code></td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>boolean (default <q>false</q>)</td>
|
|
|
|
<td>Enable emacs-compatible error messages;
|
|
|
|
see <a href="Tasks/javac.html">javac</a> "Jikes Notes".
|
2003-12-03 11:25:04 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>build.compiler.fulldepend</code></td>
|
|
|
|
<td>boolean (default false)</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>Enable full dependency checking;
|
|
|
|
see <a href="Tasks/javac.html">javac</a> "Jikes Notes".
|
2003-12-03 11:25:04 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>build.compiler.jvc.extensions</code></td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td><em><u>Deprecated</u></em></td>
|
|
|
|
<td>Enable Microsoft extensions of their Java compiler;
|
|
|
|
see <a href="Tasks/javac.html">javac</a> "Jvc Notes".
|
2003-12-03 11:25:04 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>build.compiler.pedantic</code></td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>boolean (default <q>false</q>)</td>
|
|
|
|
<td>Enable pedantic warnings;
|
|
|
|
see <a href="Tasks/javac.html">javac</a> "Jikes Notes".
|
2003-12-03 11:25:04 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>build.compiler.warnings</code></td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td><em><u>Deprecated</u></em></td>
|
|
|
|
<td>See <a href="Tasks/javac.html">javac</a> "Jikes Notes"</td>
|
2003-12-03 11:25:04 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>build.rmic</code></td>
|
|
|
|
<td>name</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>Control the <a href="Tasks/rmic.html">rmic</a> compiler</td>
|
2003-12-03 11:25:04 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>build.sysclasspath</code></td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No default value</td>
|
|
|
|
<td>See <a href="sysclasspath.html">its dedicated page</a></td>
|
2003-12-03 11:25:04 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>file.encoding</code></td>
|
|
|
|
<td>name of a supported character set (e.g. UTF-8, ISO-8859-1, US-ASCII)</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>use as default character set of email messages; use as default
|
|
|
|
for <var>srcencoding</var>, <var>destencoding</var>
|
|
|
|
and <var>bundleencoding</var>
|
|
|
|
in <a href="Tasks/translate.html">translate</a><br/> see JavaDoc
|
|
|
|
of <a target="_blank"
|
|
|
|
href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html">java.nio.charset.Charset</a>
|
|
|
|
for more information about character sets (not used in Ant, but
|
|
|
|
has nice docs).
|
2003-12-03 11:25:04 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>jikes.class.path</code></td>
|
|
|
|
<td>path</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>The specified path is added to the classpath if Jikes is used as compiler.</td>
|
2003-12-03 11:25:04 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>MailLogger.properties.file, MailLogger.*</code></td>
|
|
|
|
<td>filename (optional, defaults derived from Project instance)</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>Name of the file holding properties for sending emails by
|
|
|
|
the <a href="listeners.html#MailLogger">MailLogger</a>. Override
|
|
|
|
properties set inside the buildfile or via command line.
|
2003-12-03 11:25:04 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><code>org.apache.tools.ant.ProjectHelper</code></td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>classname (optional, default <q>org.<wbr>apache.<wbr>tools.<wbr>ant.<wbr>ProjectHelper2</q>)</td>
|
|
|
|
<td>specifies the classname to use as ProjectHelper. The class must
|
|
|
|
extend <code>org.apache.tools.ant.ProjectHelper</code>.
|
2003-12-03 11:25:04 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
2012-09-16 13:42:41 +00:00
|
|
|
<tr>
|
|
|
|
<td><code>org.apache.tools.ant.ArgumentProcessor</code></td>
|
|
|
|
<td>classname (optional)</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>specifies the classname to use as ArgumentProcessor. The class
|
|
|
|
must extend <code>org.apache.tools.ant.ArgumentProcessor</code>.
|
2012-09-16 13:42:41 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
2003-12-03 11:25:04 +00:00
|
|
|
<tr>
|
2009-09-27 10:59:48 +00:00
|
|
|
<td><code>websphere.home</code></td>
|
2003-12-03 11:25:04 +00:00
|
|
|
<td>path</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>Points to home directory of WebSphere;
|
|
|
|
see <a href="Tasks/ejb.html#ejbjar_websphere">EJB Tasks</a>
|
2003-12-03 11:25:04 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2009-09-27 10:59:48 +00:00
|
|
|
<td><code>XmlLogger.file</code></td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>filename (default <q>log.xml</q>)</td>
|
2003-12-03 11:25:04 +00:00
|
|
|
<td>Name for the logfile for <a href="listeners.html#MailLogger">MailLogger</a>.
|
|
|
|
</td>
|
|
|
|
</tr>
|
2009-09-27 10:59:48 +00:00
|
|
|
<tr>
|
|
|
|
<td><code>ant.project-helper-repo.debug</code></td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>boolean (default <q>false</q>)</td>
|
|
|
|
<td>Set it to <q>true</q> to enable debugging with
|
|
|
|
Ant's <a href="projecthelper.html#repository">ProjectHelper internal
|
|
|
|
repository</a>.
|
2009-09-27 10:59:48 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
2012-09-16 13:42:41 +00:00
|
|
|
<tr>
|
|
|
|
<td><code>ant.argument-processor-repo.debug</code></td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>boolean (default <q>false</q>)</td>
|
|
|
|
<td>Set it to <q>true</q> to enable debugging with
|
|
|
|
Ant's <a href="argumentprocessor.html#repository">ArgumentProcessor
|
|
|
|
internal repository</a>.
|
2012-09-16 13:42:41 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
2017-05-08 18:44:07 +02:00
|
|
|
<tr>
|
|
|
|
<td><code>ant.tstamp.now</code></td>
|
|
|
|
<td>number, seconds since the epoch (midnight 1970-01-01)</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td rowspan="2">The value to use as current time and date for <tstamp></td>
|
2017-05-08 18:44:07 +02:00
|
|
|
</tr>
|
2017-05-09 11:01:51 +02:00
|
|
|
<tr>
|
|
|
|
<td><code>ant.tstamp.now.iso</code></td>
|
|
|
|
<td>ISO-8601 timestamp string like <code>1972-04-17T08:07:00Z</code></td>
|
|
|
|
</tr>
|
2003-12-03 11:25:04 +00:00
|
|
|
</table>
|
2003-11-28 11:56:29 +00:00
|
|
|
|
2005-01-13 23:09:32 +00:00
|
|
|
<p>
|
2018-02-28 07:58:59 +01:00
|
|
|
If new properties get added (it happens), expect them to appear under
|
|
|
|
the <code>ant.</code> and <code>org.apache.tools.ant.</code> prefixes,
|
|
|
|
unless the developers have a very good reason to use another
|
|
|
|
prefix. Accordingly, please avoid using properties that begin with
|
|
|
|
these prefixes. This protects you from future Ant releases breaking
|
|
|
|
your build file.
|
2005-01-13 23:09:32 +00:00
|
|
|
</p>
|
2005-12-05 22:28:46 +00:00
|
|
|
<h3>return code</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>
|
|
|
|
Ant start up scripts (in their Windows and Unix version) return the
|
|
|
|
return code of the <code>java</code> program. So a successful build
|
2018-03-02 08:23:45 +01:00
|
|
|
returns <q>0</q>, failed builds return other values.
|
2005-12-05 22:28:46 +00:00
|
|
|
</p>
|
2005-01-13 23:09:32 +00:00
|
|
|
|
2018-02-08 22:52:33 +01:00
|
|
|
<h2 id="cygwin">Cygwin Users</h2>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>
|
|
|
|
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 which operates as a native Windows application. The JDK is not
|
|
|
|
a Cygwin executable, and it therefore has no knowledge of Cygwin
|
|
|
|
paths, etc. In particular when using the <code><exec></code>
|
|
|
|
task, executable names such as <q>/bin/sh</q> will not work, even
|
|
|
|
though these work from the Cygwin shell from which Ant was
|
|
|
|
launched. You can use an executable name such as <q>sh</q> and rely on
|
|
|
|
that command being available in the Windows path.
|
2003-02-01 14:21:27 +00:00
|
|
|
</p>
|
|
|
|
|
2018-02-08 22:52:33 +01:00
|
|
|
<h2 id="os2">OS/2 Users</h2>
|
2018-02-28 07:58:59 +01:00
|
|
|
<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 above. The behaviour can be modified by a
|
|
|
|
number of ways explained below.
|
|
|
|
</p>
|
2003-04-23 15:57:43 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>
|
|
|
|
Script <code>ant.cmd</code> first verifies whether the Ant environment
|
|
|
|
is set correctly. The requirements are:
|
|
|
|
</p>
|
2003-04-23 15:57:43 +00:00
|
|
|
<ol>
|
|
|
|
<li>Environment variable <code>JAVA_HOME</code> is set.</li>
|
|
|
|
<li>Environment variable <code>ANT_HOME</code> is set.</li>
|
2005-05-09 15:36:39 +00:00
|
|
|
<li>Environment variable <code>CLASSPATH</code> is set and contains at least one element from
|
2003-04-23 15:57:43 +00:00
|
|
|
<code>JAVA_HOME</code> and at least one element from <code>ANT_HOME</code>.</li>
|
|
|
|
</ol>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>
|
|
|
|
If any of these conditions is violated, script <code>antenv.cmd</code>
|
|
|
|
is called. This script first invokes configuration scripts if there
|
|
|
|
exist: the system-wide configuration <code>antconf.cmd</code> from
|
|
|
|
the <samp>%ETC%</samp> directory and then the user
|
|
|
|
configuration <code>antrc.cmd</code> from the <samp>%HOME%</samp>
|
|
|
|
directory. At this moment both <code>JAVA_HOME</code>
|
|
|
|
and <code>ANT_HOME</code> must be defined
|
|
|
|
because <code>antenv.cmd</code> now adds <samp>classes.zip</samp>
|
|
|
|
or <samp>tools.jar</samp> (depending on version of JVM) and everything
|
|
|
|
from <samp>%ANT_HOME%\lib</samp> except <samp>ant-*.jar</samp>
|
|
|
|
to <code>CLASSPATH</code>. Finally <code>ant.cmd</code> calls
|
|
|
|
per-directory configuration <code>antrc.cmd</code>. All settings made
|
|
|
|
by <code>ant.cmd</code> are local and are undone when the script
|
|
|
|
ends. The settings made by <code>antenv.cmd</code> are persistent
|
|
|
|
during the lifetime of the shell (of course unless called
|
|
|
|
automatically from <code>ant.cmd</code>). It is thus possible to
|
|
|
|
call <code>antenv.cmd</code> manually and modify some settings before
|
|
|
|
calling <code>ant.cmd</code>.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
Scripts <code>envset.cmd</code> and <code>runrc.cmd</code> perform
|
|
|
|
auxiliary tasks. All scripts have some documentation inside.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<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
|
|
|
|
immediately try to read from standard input, which in turn will most
|
|
|
|
likely suspend the process. In order to avoid this, you must redirect
|
|
|
|
Ant's standard input or explicitly provide input to each spawned
|
|
|
|
process via the input related attributes of the corresponding tasks.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
Tasks that create such new processes
|
|
|
|
include <code><exec></code>, <code><apply></code>
|
|
|
|
or <code><java></code> when the <var>fork</var> attribute
|
|
|
|
is <q>true</q>.
|
|
|
|
</p>
|
2008-07-18 13:09:30 +00:00
|
|
|
|
2018-02-08 22:52:33 +01:00
|
|
|
<h2 id="viajava">Running Ant via Java</h2>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>
|
|
|
|
If you have installed Ant in the do-it-yourself way, Ant can be
|
|
|
|
started from one of two entry points:
|
|
|
|
</p>
|
2001-04-10 07:06:37 +00:00
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>java -Dant.home=c:\ant org.apache.tools.ant.Main [options] [target]</pre>
|
|
|
|
<pre>java -Dant.home=c:\ant org.apache.tools.ant.launch.Launcher [options] [target]</pre>
|
2003-10-02 06:44:27 +00:00
|
|
|
|
|
|
|
<p>
|
2018-02-28 07:58:59 +01:00
|
|
|
The first method runs Ant's traditional entry point. The second method
|
|
|
|
uses the Ant Launcher introduced in Ant 1.6. The former method does
|
|
|
|
not support the <code>-lib</code> option and all required classes are
|
|
|
|
loaded from the <code>CLASSPATH</code>. You must ensure that all
|
|
|
|
required jars are available. At a minimum the <code>CLASSPATH</code>
|
|
|
|
should include:
|
2003-10-02 06:44:27 +00:00
|
|
|
</p>
|
|
|
|
|
2001-04-10 07:06:37 +00:00
|
|
|
<ul>
|
2018-02-28 07:58:59 +01:00
|
|
|
<li><samp>ant.jar</samp> and <samp>ant-launcher.jar</samp></li>
|
2001-04-10 07:06:37 +00:00
|
|
|
<li>jars/classes for your XML parser</li>
|
|
|
|
<li>the JDK's required jar/zip files</li>
|
|
|
|
</ul>
|
2003-10-02 06:44:27 +00:00
|
|
|
|
|
|
|
<p>
|
2018-02-28 07:58:59 +01:00
|
|
|
The latter method supports
|
|
|
|
the <code>-lib</code>, <code>-nouserlib</code>, <code>-noclasspath</code>
|
|
|
|
options and will load jars from the
|
|
|
|
specified <code>ANT_HOME</code>. You should start the latter with the
|
|
|
|
most minimal classpath possible, generally just
|
|
|
|
the <samp>ant-launcher.jar</samp>.
|
2003-10-02 06:44:27 +00:00
|
|
|
</p>
|
|
|
|
|
2018-02-08 22:52:33 +01:00
|
|
|
<p id="viaant">
|
2018-02-28 07:58:59 +01:00
|
|
|
Ant can be started in Ant via the <code><java></code> command.
|
|
|
|
Here is an example:
|
2018-02-08 22:52:33 +01:00
|
|
|
</p>
|
2006-07-13 11:07:58 +00:00
|
|
|
<pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<java classname="org.apache.tools.ant.launch.Launcher"
|
|
|
|
fork="true"
|
|
|
|
failonerror="true"
|
|
|
|
dir="${sub.builddir}"
|
|
|
|
timeout="4000000"
|
|
|
|
taskname="startAnt">
|
2006-07-13 11:07:58 +00:00
|
|
|
<classpath>
|
|
|
|
<pathelement location="${ant.home}/lib/ant-launcher.jar"/>
|
|
|
|
</classpath>
|
|
|
|
<arg value="-buildfile"/>
|
|
|
|
<arg file="${sub.buildfile}"/>
|
|
|
|
<arg value="-Dthis=this"/>
|
|
|
|
<arg value="-Dthat=that"/>
|
|
|
|
<arg value="-Dbasedir=${sub.builddir}"/>
|
|
|
|
<arg value="-Dthe.other=the.other"/>
|
|
|
|
<arg value="${sub.target}"/>
|
|
|
|
</java>
|
|
|
|
</pre>
|
2001-04-10 07:06:37 +00:00
|
|
|
|
|
|
|
</body>
|
2006-10-29 19:49:44 +00:00
|
|
|
</html>
|