Ivy files describe the dependencies of a Java library or application, something they term a module.
Every module or child project in a big application has its own ivy.xml file. This file lists what configurations
the module has, such as compile, test, standalone, or embedded.
Each configuration lists the artifacts it depends on and the artifacts it generates.
The dependencies can be used to set up the classpath for part of the project or to compile files for
redistribution.
The generated artifacts can be published to a repository, including the local file system. Other projects can declare a dependency on the published artifacts, listing the name of the project, the module, and the version required.
They can also declare the configurations of a module on which they want to depend.
A module not only exports its own artifacts, but it can also export those artifacts on which it depends.
Our first ivy.xml file
The first action is to create the ivy.xml file for diary/core, our core diary library.
Listing 11.1 The ivy.xml file for the diary-core module
<ivy-module version="1.4">
<info organisation="org.antbook" module="diary-core" />
<configurations defaultconfmapping="default">
<conf name="compile" visibility="private"/>
<conf name="test" extends="compile" visibility="private"/>
<conf name="master" />
<conf name="runtime" extends="compile"/>
<conf name="default" extends="master,runtime"/>
</configurations>
<publications>
<artifact conf="master"/>
</publications>
<dependencies>
<dependency org="log4j" name="log4j" rev="1.2.13"
conf="compile->default;runtime->default"/>
<dependency org="junit" name="junit" rev="3.8.2"
conf="test->default"/>
</dependencies>
</ivy-module>