concept configuration in category ant

appears as: configuration, configurations, The configuration, configurations, configuration
Ant in Action

This is an excerpt from Manning's book Ant in Action.

Figure 11.1. Ivy reports the dependencies for one of the configurations

3.  Define a common set of configurations for all projects, such as those of table 11.2.

A common set of configurations can be shared across ivy.xml files with the <include> element:

<configurations>
  <include file="../ivy/configurations.xml" />
  <configuration name="package" extends="runtime" />
<configurations>

Including configurations from a shared file keeps maintenance effort down and makes it easy to add new configurations to all applications. Unfortunately, Ivy 1.4.1 has a bug here: it tries to resolve relative paths in the project running the task, including <ivy:buildlist> in a parent directory. It should be fixed in a later release.

This is an important feature of dependency management tools. Their goal is to simplify your life by giving you all the files you need. There’s a price: sometimes you get more than you want. As we don’t need Log4J to compile the web application and we don’t want it at runtime, we must ask for a configuration that contains the diary-core artifact but not its dependencies.

The choice of public configurations is based on those of Maven2, because whenever Ivy pulls in metadata from the Maven repositories, it parses the metadata and maps it to Ivy configurations. Maven only supports the configurations of table 11.2.

Table 11.2. Maven2’s dependency configurations, as interpreted by Ivy

Configuration name

Meaning

default The artifact and its runtime dependencies
master The artifact itself
runtime All the runtime dependencies of the artifact
compile Dependencies used to compile the artifact
provided Compile time dependencies to be pre-installed on the classpath
system Runtime dependencies to be pre-installed on the classpath

Ivy doesn’t mandate any specific configurations. We normally start off with the Maven team’s configurations to be consistent with artifacts coming from the Maven repository. The master configuration has the artifacts with no dependencies, runtime has the dependencies with no artifact, and default has both. We use these standard configurations to make it possible to publish artifacts to the central repository, something that’s beyond the scope of this book. We can still add private configurations for internal use (such as setting up a <taskdef> classpath) or to create new public configurations with different dependencies, such as embedded, redist, or webapp.