ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Don Ferguson <...@bea.com>
Subject JLink vs. Jar
Date Fri, 29 Dec 2000 23:49:06 GMT
I have recently begun exploring ant, and have found the JLink task to be
insufficient for my needs, and also, not consistent with other file
based ant tasks.  Specifically, JLink does not provide a mechanism for
selecting a subset of a jar file via includes/excludes.  It also seems
to me that there is too much overlap in the functionality provided by
Jar and JLink, so in my copy of the sources, I have modified the Jar
task to subsume the capabilities of JLink by addition of a new data
type: JarFilter.  The Jar task can include both FileSets and
JarFilters.  A JarFilter extracts a subset of files from the jar using
the same matching rules as FileSets, and includes these files in the
output jar.  For example, the following would create "myant.jar",
including my ant classes with the standard ant.jar, but excluding JLink:

<?xml version="1.0"?>

<project name="JarExample" default="main" basedir=".">
    <target name="main">
      <jar jarfile="myant.jar">
        <fileset dir="/home/don/classes"
              includes="weblogic/ant/"
        />
        <jarfilter jarfile="/ant/lib/ant.jar"
                      includes="org/apache/"

excludes="org/apache/tools/ant/taskdefs/optional/jlink/"
        />
      </jar>
    </target>
</project>


I think this make the Jar task much more useful, but as I'm new to ant,
I'd be curious to hear what others have to say about this approach.
Comments?

    -Don



Mime
View raw message