Alias Declaration
Using alias statements

In the previouse example we created a jar file and based on the standard naming convensions the generated artifact was named demo-SNAPSHOT.jar. This naming convension is based on the [name]-[VERSION].[TYPE] pattern. In some situations we want to reference artifact using a logical version (or no version). This can be achived though the declaration of an alias under the type production element.

Adding an Alias

To simplify local management of modules we can use the alias attribuite on a type declaration declaration. This request the creation of a link which is an artifact that references another artifact. The following example demonstrates the addition of an alias attribute to the type production statement in the demo project.

<?xml version="1.0" encoding="ISO-8859-1"?>
<index xmlns="dpml:library">

  <project name="demo" basedir=".">
      <property name="location" value="New York"/>
      <property name="message" value="Hello from ${user.name} in ${location}"/>
      <type id="jar" alias="true"/>
      <filter token="MESSAGE" value="${message}"/>


The alias attribute is recognized by the Depot antlib and will result in the automatic production of an unversioned symbolic link (a.ka. alias). The link definition is created in the target/deliverables/jars directly under the name demo.jar.link. This file contains an artifact uri refernecing the real artifact.

Contents of ${basedir}/target/deliverables/jars/demo.jar.link


Subsequent build or runtime systems that reference resource via artifact-based uris can using the link protocol to retrieve the resource. For example, the following project definition demonstrates the usage of a alias reference via the link protocol.

  <project name="example" basedir="somewhere">
        <include uri="link:jar:demo"/>

The link datastructure is simply a reference to a versioned artifact (similar to a unix symlink for artifacts). This tutorial has covered the creation of a simple non-versioned alias associated with the produced jar file. Alias attributes may be used on any resource type production statement.

The following tutorial moves on to the broader subject of unit testing in an environment backed by a rich project model.