ant
Automate Java software build processes
TLDR
Build a project with default build file build.xml
Build a project using build file other than build.xml
Print information on possible targets for this project
Print debugging information
Execute all targets that do not depend on fail target(s)
SYNOPSIS
ant [-help] [-projecthelp] [-version] [-buildfile <file>] [-logfile <file>] [-D<property>=<value> ...] [-logger <classname>] [-listener <classname>] [-verbosity <#>] [-debug] [-emacs] [-diagnostics] [-find <file>] [-inputhandler <class>] [-main <class>] [-nice <#>] [-nouserlib] [-noclasspath] [-lib <path>] [-propertyfile <name>] [target [target2 ...]]
PARAMETERS
-help
Prints a summary of available options
-projecthelp
Prints the description of all targets in buildfile
-version
Prints Ant version information
-buildfile <file>
-file <file>
-f <file>
Uses specified buildfile; defaults to build.xml
-logfile <file>
Uses quiet logger and redirects output to file
-logger <classname>
Uses given class as logger implementation
-listener <classname>
Adds given class as listener
-verbosity <#>
Sets logging verbosity: 0=quiet, ..., 4=verbose
-debug
Enables debug logging (verbosity level 4)
-emacs
Produces logging output in Emacs mode
-diagnostics
Prints diagnostics info
-find <file>
Searches parent directories for specified buildfile
-D<property>=<value>
Sets a JVM system property
-nice <#>
Sets runtime priority (nice value)
-nouserlib
Prevents use of ~/.ant/lib jars
-lib <path>
Searches for JARs in specified path
DESCRIPTION
Apache Ant is a cross-platform Java library and command-line tool designed to drive processes defined in build.xml files. These XML files specify targets—discrete tasks like compiling code, running tests, or creating JARs—that depend on each other, forming a dependency graph executed sequentially.
Unlike Makefiles, Ant uses XML for readability and platform independence, avoiding shell scripting complexities. It's widely used in Java projects for automating builds, deployments, and integrations. Ant supports extension points for custom tasks via Java classes and includes built-in tasks for file operations, Java compilation (javac), JUnit testing, and more.
Invoke Ant in a directory with a build.xml; it defaults to the default or first target. Properties (key-value pairs) customize behavior, overridden via command-line -D flags. Ant's extensibility makes it suitable for complex workflows, though modern alternatives like Maven or Gradle offer convention-over-configuration.
Ant requires a JDK and is invoked via the ant script, which sets up classpath and launches the Java entry point.
CAVEATS
Requires JDK/JRE installed and ant in PATH. No automatic dependency resolution like Maven; relies on explicit target deps. XML buildfiles can become verbose for large projects.
DEFAULT BEHAVIOR
Defaults to build.xml in current directory. Runs first or default target if unspecified.
PROPERTIES
Key-value pairs loaded from buildfile, command-line, or files. Accessed via ${property.name}.
TASKS
Built-in tasks like <javac>, <jar>, <junit>; extensible via custom Java classes.
HISTORY
Originated in Apache Tomcat 1998 as a Make replacement. Became standalone Apache Ant project July 2000 (v1.1). Evolved through v1.6 (2006) with Ivy integration, to v1.10+ (2015+), focusing on Java 8+ support and security fixes. Maintained by Apache Software Foundation.


