ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens v.P." <>
Subject Why are there paths and filesets?
Date Tue, 18 Dec 2001 10:57:11 GMT
Hello Ant Users,

  I'm wondering why there exist two different concepts of list of
files: path and fileset.
  Both elements fullfill nearly the same purpose - so why are there
two of them?

  My problem is that they are not compatible. Using the javac-task, I
have to define a path, the zip task requires a fileset. In my case -
and I think it's a very common one - I have a compile and a zip
target, the first one compiling all my java classes, the second one
creating a zip containing all necessary binary files.
  Both targets require my classpath, that is my list of all libs
(jars), used for compiling and, of course, needed in a binary
distribution. I don't want to define the list twice, so I define it this way:

<?xml version="1.0" encoding="UTF-8"?>
<project name="test" basedir="." default="compile">
        <property name="src" value="src"/>
    <property name="lib" value="lib"/>  
        <property name="build" value="build"/>
    <property name="build.classes" value="${build}/classes"/>
    <property name="build.dist" value="${build}/dist"/>
        <property name="libs" value="${lib}/jdom.jar;[...];${lib}/batik.jar;${lib}/fop.jar"
    <target name="init">
        <path id="lib.path">
            <pathelement path="${libs}" />
        <pathconvert property="lib.fileset" pathsep="," dirsep="/" refid="lib.path">
                <map from="${basedir}\" to=""/>
                <map from="${basedir}/" to=""/>
        <target name="compile" description="Compile the source files" depends="init">
       <mkdir dir="${build.classes}"/>
       <javac srcdir="${src}" destdir="${build.classes}" deprecation="off" classpathref="lib.path"
           <exclude name="**/*.html;**/Makefile" />
    <target name="makezip" description="Zip all libs" depends="init">
       <mkdir dir="${build.dist}"/>
       <zip zipfile="${build.dist}/${}">
            <fileset dir="${basedir}" includes="${lib.fileset}" />

  It's working - but I think this way looks quite like a workaround.
The workaround is placed in target init where, based on the
properterty "libs" two kind of file lists (a path and a fileset) are
  Is there another way of solving the problem? And I've got still the
question: Why is there a fileset and a path definition, if, as shown
in my example, both are fullfilling the same requirements?

Best regards,

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message