Java Reference
In-Depth Information
Gradle goes further yet, and allows scripting logic in its configuration file (strictly speaking, Ant
and Maven do as well, but Gradle's is much easier to use).
make
is simpler to extend, but harder to do so portably. You can write a one-line
make
rule for
getting a CVS archive from a remote site, but you may run into incompatibilities between GNU
make
, BSD
make
, Microsoft
make
, and so on. There is a built-in Ant task for getting an archive
from CVS using Ant; it was written as a Java source file instead of just a series of command-line
commands.
make
has been around much longer. There are probably millions (literally) more
Makefiles
than
Ant files. Non-Java developers have typically not heard of Ant; they almost all use
make
. Most
non-Java open source projects use
make
, except for programming languages that provide their
own build tool (e.g., Ruby provides Rake and Thor, Haskell provides Cabal, …).
The advantages of the Java tools make more sense on larger projects. Primarily,
make
has been
used on the really large projects. For example,
make
is used for telephone switch source code,
which consists of hundreds of thousands of source files totalling tens or hundreds of millions of
lines of source code. By contrast, Tomcat is about 500,000 lines of code, and the JBoss Java EE
server “WildFly” is about 800,000 lines. Use of the Java tools is growing steadily, particularly
now that most of the widely used Java IDEs (JBuilder, Eclipse, NetBeans, etc.) have interfaces to
Ant, Maven, and/or Gradle. Effectively all Java open source projects use Ant (or its larger and
stronger sibling, Maven) or the newest kid on that block, Gradle.
make
is included with most Unix and Unix-like systems and shipped with many Windows IDEs.
Ant and Maven are not included with any operating system distribution that I know of, but can be
installed as packages on almost all, and both are available direct from Apache. The same is true
for Gradle, but it installs from
http://gradle.org
,
and Buildr from the
Apache website
.
To sum up, although
make
and the Java tools are good, new Java projects should use one of the
newer Java-based tools such as Maven or Gradle.
Automating Dependencies, Compilation, Testing, and
Deployment with Apache Maven
Problem
You tried Ant and liked it, but want a tool that does more automatically.