How-To Guides
Getting Started
Policy Strategies
Format Strings
Extending Antlion
First Tutorial: Simple
Ant Tasks
inner processors
inner repositories
Optional Tasks
About optional tasks
A library policy defines a set of repositories with library processors that dictate the policy of how libraries are found and integrated into the Ant project.

By containing all of these together, the user can dictate once, for all <libraryDef>s in a project, the details of libraries.

The how-to guide contains several sections that can help you get started setting up a library policy for your project. The section on repositories describes different ways to setup your warehouse for external libraries. The policies section describes different techniques to setup the <library-policy> to efficiently and effectively reference those libraries from your Ant scripts.

Descriptions for the repositories themselves, as referenced within a <library-policy>, can be found here. The list of built-in library processors can be found here.

Attribute Description Required
addDefault Deprecated in favor of the <defaults> processor, which was introduced in Antlion 0.7.0. This parameter will be removed in Antlion 1.0.0.

When enabled, this adds the default processors to this policy, in addition to the processors specified. The default processor set works like adding the following to the end of your policy:
<path />
<fileset />
<attribute />
<manifest-classpath />
    <format text="[groupid].[artifactid]-[current].[type]" />
    <format text="[groupid].[artifactid]-[version].[type]" />
    <format text="[group].[artifact]-[current].[type]" />
    <format text="[group].[artifact]-[version].[type]" />

The default processors are only added when this attribute is specified and enabled (set to "true" or "yes").
parentRef Since Antlion 0.7.0.

Adds the policy with the given ID as a "parent" to this policy.

Nested Elements


As of Antlion 0.5.0, this has been deprecated in favor of referencing the processors in-line. This will be removed in Antlion 1.0.0.

A library type definition that describes how the libraries will be processed to generate Ant properties and references. See the entry on the <library-type> task for more details about setting this up.

There can be only one type per library definition. If a type isn't specified, then the default type (described above) will be used.


Since Antlion 0.7.0.

Defines a parent policy. There may be more than one parent, but this is discouraged.

Attribute Description Required
refid The ID of the parent policy. Yes

<library-policy id="sitewide-policy">
  <repository basedir="${3rdparty.dir}"
    format="[group]/[version]/[artifact].[type]" />

  <defaults />
    <attribute attrib="version" property="lib.[group].version" />
Defines a policy called "sitewide-policy" that extends the default type to include loading the "version" attribute from the Ant properties, and also defines a file repository. Any <libraryDef> using this policy cannot add additional setup type processors or repositories.
<library-policy id="sitewide-policy">
  <repository basedir="${3rdparty.dir}"
    format="[group]/[version]/[artifact].[type]" />

  <defaults />
    <attribute attrib="version" property="lib.[group].version" />
The same as the previous example, but the defaults are defined using the <defaults> processor element.

Document version $Revision: 1.7 $ $Date: 2005/10/31 04:38:22 $

SourceForge Logo
Copyright © 2004-2006, The Antlion Project