com.i3sp.ant
Class MungeJar

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.Task
              |
              +--org.apache.tools.ant.taskdefs.MatchingTask
                    |
                    +--org.apache.tools.ant.taskdefs.Zip
                          |
                          +--org.apache.tools.ant.taskdefs.Jar
                                |
                                +--com.i3sp.ant.MungeJar

public class MungeJar
extends org.apache.tools.ant.taskdefs.Jar

Ant task to produces a jar file from a CLASSPATH.

This task produces a munged jar file of elements in a classpath. It is suitable for building a jar for includion in a war or ear file where the classpath ordering is significant. Simply placing individual elements in the WEB-INF/lib directory (for example) does not guarantee that one jar will be loaded before any other. The jar resulting from this operation will ensure that the earliest occurence of a class in your path is included.

This task extends Jar, so all of its options are relevant.

Parameters

The Task has the following attributes:
Attribute Description Required
jar The jar file to produce. Yes
tmpdir A temporary directory to use for building the munged jar file. Yes
classpath The classpath to munge. No
cleanup (boolean) Cleanup the tmpdir after running - if true, causes the task to re-run completely each time, since the intermediate files will be removed. No

The classpath can also be specified by nested classpath or classpathref elements.

Example

 <mungejar jar="${basedir}/jar/com.i3sp.sso.munge.jar"
           tmpdir="${basedir}/gensrc"
           classpath="${CLASSPATH}" />
 

Version:
$Revision: 1.2 $ $Date: 2002/04/22 14:46:13 $
Author:
Matthew Watson

Inner classes inherited from class org.apache.tools.ant.taskdefs.Zip
org.apache.tools.ant.taskdefs.Zip.WhenEmpty
 
Constructor Summary
MungeJar()
           
 
Method Summary
 org.apache.tools.ant.types.Path createClasspath()
          Maybe creates a nested classpath element.
 void execute()
           
 void setClasspath(org.apache.tools.ant.types.Path cp)
          Set the classpath to be used for this compilation.
 void setClasspathRef(org.apache.tools.ant.types.Reference r)
          Adds a reference to a CLASSPATH defined elsewhere.
 void setCleanup(boolean cl)
           
 void setJar(java.io.File jar)
          Set the destination jar file into which to muge all the path elements
 void setJarfile(java.io.File jar)
           
 void setTmpdir(java.io.File tmp)
          Set the temporary directory for building the munge file
 
Methods inherited from class org.apache.tools.ant.taskdefs.Jar
addConfiguredManifest, addMetainf, setManifest
 
Methods inherited from class org.apache.tools.ant.taskdefs.Zip
addFileset, addZipfileset, setBasedir, setCompress, setEncoding, setFilesonly, setUpdate, setWhenempty, setZipfile
 
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask
createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, setDefaultexcludes, setExcludes, setExcludesfile, setIncludes, setIncludesfile, XsetIgnore, XsetItems
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, init, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setTaskName
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MungeJar

public MungeJar()
Method Detail

setJar

public void setJar(java.io.File jar)
Set the destination jar file into which to muge all the path elements

setJarfile

public void setJarfile(java.io.File jar)
Overrides:
setJarfile in class org.apache.tools.ant.taskdefs.Jar

setClasspath

public void setClasspath(org.apache.tools.ant.types.Path cp)
Set the classpath to be used for this compilation.

setCleanup

public void setCleanup(boolean cl)

setTmpdir

public void setTmpdir(java.io.File tmp)
Set the temporary directory for building the munge file

createClasspath

public org.apache.tools.ant.types.Path createClasspath()
Maybe creates a nested classpath element.

setClasspathRef

public void setClasspathRef(org.apache.tools.ant.types.Reference r)
Adds a reference to a CLASSPATH defined elsewhere.

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Overrides:
execute in class org.apache.tools.ant.taskdefs.Zip


Copyright 2001 i3SP Pty. Ltd. All Rights Reserved.