EXPERT OPINION
“I find Apache Ant
(Another Neat Tool) very
useful for automating the
build process. I especially
appreciate its use of XML, which facilitates
build-script creation, and the JUnit task,
which facilitates integration of JUnit test-
ing into the process.”
—Jeff Friesen,
Freelance Developer and Educator
“I love using Maven in large
organizations—where many
developers are working on
multiple projects. Some very
deep thought about the software project
lifecycle has gone into Maven over the years,
and its strict standards approach works bril-
liantly where chaos can potentially abound.
It doesn’t matter which project developers
join. A Maven mvn clean install command
builds, tests, packages, and installs a local
copy of the application for them, letting
them get started with their coding.
Having good build and CI processes in
place means that you can write code more
quickly and maintain a higher bar of quality. In conjunction with TDD [test-driven
development], build and CI means you can
rapidly refactor without fear! Think of it as
having a mentor looking over your shoulder—
providing a safe and controlled environment
in which you can quickly code and make
bold changes.”
—Martijn Verburg, Coauthor,
The Well-Grounded Java Developer
“For me, the real difference
is between tools that have
a point of view about how
development processes
should work and those that don’t. I call
these two types ‘tools and metatools.’
Maven is a build tool, because it essentially
forces you to adapt to the Maven lifecycle
and way of doing things. Ant doesn’t come
with such a point of view—instead, you
have to build up targets and a sequence
based on your own project lifecycle. Some
teams prefer the additional structure which
comes with a tool like Maven, whereas other
teams object to having to fit in with the
demands of the Maven lifecycle.”
—Ben Evans, Coauthor,
The Well-Grounded Java Developer
01BUILD AUTOMATION TOOLS
COMMUNITY
“Identifying and download-
ing the correct versions of a
Java project’s dependent JAR
files, which may have been
obtained from a variety of online sources, is
a thankless and often error-prone activity.
Maven takes care of this for you, and effec-
tively structures your project so as to elimi-
nate a host of setup and configuration issues.
Maven provides plug-ins that encourage and
promote good standard software practices—
including unit testing, version control, and
standardized release processes.
A build automation tool ideally provides
the ability to build a given project with a
single command, mobilizing all the
modules, artifacts, libraries, and code
necessary to that project.
Apache Maven. Hosted by the Apache
Software Foundation and written in Java,
Maven can be used to build projects in
Java, as well as C#, Ruby, Scala, and other
languages. It operates from an XML file,
but uses a very different paradigm from
Ant. Rather than simply chaining together
sequential build tasks, as occurs with
Ant, Maven defines a project in terms of
its dependencies, external modules and
components, build order, directories, and
required plug-ins. Maven projects are
defined via a Project Object Model (POM)
file (pom.xml). Maven dynamically downloads Java libraries and Maven plug-ins
from either the Maven Central repository
or other defined software repositories.
Larger Maven projects are typically
divided into several subprojects, each
with its own POM file, but with a root
POM to compile the master project via
a single command. The Maven plug-in
architecture allows it to interface with
build tools for other languages, including
the .NET framework and C/C++. Popular
IDEs that support development with
Maven include Eclipse, IntelliJ, JBuilder,
JDeveloper, and NetBeans.
Gradle. Written in Java and Groovy, Gradle
builds upon the concepts of Ant and
Maven but uses a Groovy-based Domain-
Ant/Ivy 101 Apache Ant. Similar to the
decades-old
UNIX Make in some respects, Apache Ant
is written in Java and is best suited to
building Java projects. It uses an XML file
(build.xml) to define a given build process
and its dependencies. Within the build file,
Ant can also delegate build work to either
native or Java-based external programs.
One of Ant’s primary goals was to solve
the portability issues of Make, where different platforms required different script
commands. Ant provides built-in functionality designed to behave the same on
all platforms. It has limited fault-handling
capabilities and no persistence of state, so
it is primarily useful only for classic build
and test processes.
Ant is supported by most major IDEs,
including Eclipse, IntelliJ, JBuilder,
JDeveloper, NetBeans, and WebSphere.
Apache Ivy. Written in Java, Apache Ivy
is a subproject of the Apache Ant project,
serving as a transitive relation dependency manager. An XML file defines
project dependencies and the resources
necessary to build the given project.
Ivy resolves and downloads required
resources from the specified repositories.
Whereas Maven is a complete build tool,
with built-in dependency management,
Ivy focuses specifically on dependency
management functionality, working in
partnership with Ant.
JAVA IN ACTION
ABOUT US