2009/04/15 - Apache HiveMind has been retired.

For more information, please explore the Attic.

Jakarta > HiveMind
Font size:      

ManifestClassPath Ant Task

Converts a classpath into a space-separated list of items used to set the Manifest Class-Path attribute.

This is highly useful when modules are packaged together inside an Enterprise Application Archive (EAR). Library modules may be deployed inside an EAR, but (in the current J2EE specs), there's no way for such modules to be added to the classpath in the deployment descriptor; instead, each JAR is expected to have a Manifest Class-Path attribute identifying the exactly list of JARs that should be in the classpath. This Task is used to generate that list.

This task is implemented as org.apache.hivemind.ant.ManifestClassPath.


Attribute Description Required
property The name of a property to set as a result of executing the task. Yes
directory If specified, then the directory attribute does two things:
  • It acts as a filter, limiting the results to just those elements that are within the directory
  • It strips off the directory as a prefix (plus the separator), creating results that are relative to the directory.

Parameters specified as nested elements


A path-like structure, used to identify what the classpath should be.


Generate a list of JARs inside the ${target} directory as relative paths and use it to set the Class-Path manifest attribute.

<manifestclasspath directory="${target}" property="manifest.class.path">
  <classpath refid="build.class.path"/>

<jar . . .>
    <attribute name="Class-Path" value="${manifest.class.path}"/>
    . . .