org.sadun.util.ant
Class Pack

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.Task
          extended byorg.sadun.util.ant.Pack

public class Pack
extends org.apache.tools.ant.Task

An ant task to pack dependencies on a given set of classes.

The available attributes are:

Additional classpath can be also specified by a nested <classpath> element.

<pack> also supports inclusion of explicitly named additional classes and/or files in the jar. Dependencies for such additional classes will be computed and added too. This is done by declaring internal <additionalclass> and <additionalfileset> elements.

<additionalclass> has a single name attribute which contains the fully qualified name of the class to include. The class must:

For example,

  <additionalclass name="javax.transaction.TransactionManager"/>
 
will add the javax.transaction.TransactionManager class and all its dependent classes to the produced jar.

<additionalfileset> is a standard Ant FileSet structure which specifies a set of files to unconditionally add to the produced jar.

For example,

  <additionalfileset dir="${basedir}"> <include name="META-INF/services/*"/> </additionalfileset>
 

will add any file under the META-INF/service subdirectory of the current ${basedir} directory.

$Revision$

Version:
1.6
Author:
Cristiano Sadun

Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
Pack()
           
 
Method Summary
 void addAdditionalFileSet(org.apache.tools.ant.types.FileSet fs)
          Ant entry point for additionalfileset subelements.
 ClassSpec createAdditionalClass()
          Ant entry point for additionalClass subelements.
 org.apache.tools.ant.types.Path createClassPath()
          Ant entry point for classpath subelements.
 ClassSpec createIgnoreClass()
          Ant entry point for ignoreClass subelements.
 Resource createResource()
          Ant entry point for additionalClass subelements.
 void execute()
          Execute the task.
 java.lang.String getClasses()
          Returns the classes.
 java.lang.String getClasspath()
          Returns the classpath.
 java.lang.String getExcludePkg()
          Returns the excludePkg.
 java.lang.String getIncludePkg()
          Returns the includePkg.
 java.lang.String getManifestClassPath()
          Returns the manifestClassPath.
 java.lang.String getManifestMainClass()
          Returns the manifestMainClass.
 java.lang.String getPackages()
          Returns the packages.
 boolean getResolveFiltered()
          Returns the resolveFiltered.
 java.lang.String getTargetJar()
          Returns the targetJar.
 boolean isCacheClassFiles()
          Returns the cacheClassFiles.
 void setCacheClassFiles(boolean cacheClassFiles)
          Sets the cacheClassFiles.
 void setClasses(java.lang.String classes)
          Sets the classes.
 void setClasspath(java.lang.String classpath)
          Sets the classpath.
 void setExcludePkg(java.lang.String excludePkg)
          Sets the excludePkg.
 void setIncludePkg(java.lang.String includePkg)
          Sets the includePkg.
 void setManifestClassPath(java.lang.String manifestClassPath)
          Sets the manifestClassPath.
 void setManifestMainClass(java.lang.String manifestMainClass)
          Sets the manifestMainClass.
 void setPackages(java.lang.String packages)
          Sets the packages.
 void setResolveFiltered(boolean resolveFiltered)
          Sets the resolveFiltered.
 void setTargetJar(java.lang.String targetJar)
          Sets the targetJar.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pack

public Pack()
Method Detail

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Execute the task.

Throws:
org.apache.tools.ant.BuildException
See Also:
Task.execute()

getClasses

public java.lang.String getClasses()
Returns the classes.

Returns:
String

setClasses

public void setClasses(java.lang.String classes)
Sets the classes.

Parameters:
classes - The classes to set

getTargetJar

public java.lang.String getTargetJar()
Returns the targetJar.

Returns:
String

setTargetJar

public void setTargetJar(java.lang.String targetJar)
Sets the targetJar.

Parameters:
targetJar - The targetJar to set

getResolveFiltered

public boolean getResolveFiltered()
Returns the resolveFiltered.

Returns:
boolean

setResolveFiltered

public void setResolveFiltered(boolean resolveFiltered)
Sets the resolveFiltered.

Parameters:
resolveFiltered - The resolveFiltered to set

getExcludePkg

public java.lang.String getExcludePkg()
Returns the excludePkg.

Returns:
String

setExcludePkg

public void setExcludePkg(java.lang.String excludePkg)
Sets the excludePkg.

Parameters:
excludePkg - The excludePkg to set

createClassPath

public org.apache.tools.ant.types.Path createClassPath()
Ant entry point for classpath subelements.


getClasspath

public java.lang.String getClasspath()
Returns the classpath.

Returns:
String

setClasspath

public void setClasspath(java.lang.String classpath)
Sets the classpath.

Parameters:
classpath - The classpath to set

getManifestClassPath

public java.lang.String getManifestClassPath()
Returns the manifestClassPath.

Returns:
String

getManifestMainClass

public java.lang.String getManifestMainClass()
Returns the manifestMainClass.

Returns:
String

setManifestClassPath

public void setManifestClassPath(java.lang.String manifestClassPath)
Sets the manifestClassPath.

Parameters:
manifestClassPath - The manifestClassPath to set

setManifestMainClass

public void setManifestMainClass(java.lang.String manifestMainClass)
Sets the manifestMainClass.

Parameters:
manifestMainClass - The manifestMainClass to set

getIncludePkg

public java.lang.String getIncludePkg()
Returns the includePkg.

Returns:
String

setIncludePkg

public void setIncludePkg(java.lang.String includePkg)
Sets the includePkg.

Parameters:
includePkg - The includePkg to set

addAdditionalFileSet

public void addAdditionalFileSet(org.apache.tools.ant.types.FileSet fs)
Ant entry point for additionalfileset subelements.

Parameters:
fs - the fileset object to add, created by Ant engine

createAdditionalClass

public ClassSpec createAdditionalClass()
Ant entry point for additionalClass subelements.

Returns:
AdditionalClass an object containing info about the class to add

createIgnoreClass

public ClassSpec createIgnoreClass()
Ant entry point for ignoreClass subelements.

Returns:
AdditionalClass an object containing info about the class to add

createResource

public Resource createResource()
Ant entry point for additionalClass subelements.

Returns:
AdditionalClass an object containing info about the class to add

isCacheClassFiles

public boolean isCacheClassFiles()
Returns the cacheClassFiles.

Returns:
boolean

setCacheClassFiles

public void setCacheClassFiles(boolean cacheClassFiles)
Sets the cacheClassFiles.

Parameters:
cacheClassFiles - The cacheClassFiles to set

getPackages

public java.lang.String getPackages()
Returns the packages.

Returns:
String

setPackages

public void setPackages(java.lang.String packages)
Sets the packages.

Parameters:
packages - The packages to set