ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Olsson" <>
Subject Generate manifest classpath with relative paths
Date Mon, 11 Jul 2005 08:44:59 GMT

At runtime my program is stored like this:


There is a ton of other .jar files too organized in the directory tree
below ./lib/ and there is so many of them that I can't just put all of
them directly in the lib directory.


I already have an ANT target that creates myprogram.jar but I also need it
to create a manifest with a proper Class-Path pointing to
./lib/commons/commons-net.jar etc etc

I managed to implement this using _absolute_ paths in the manifest but so
far I have not been able to get the paths to be _relative_. I've looked at
pathconvert and a bunch of mappers with no success. I'm using ANT 1.6.5
right now. Ideally, I would like to accomplish this without any custom ANT
tasks because my program is built by a lot of people and I do not want to
force all of them to fiddle with the extra ant task installation

Below is my ANT target so far:

   <!-- Compress to .JAR                                                  

   <target name="dist" depends="compile">
      <mkdir dir="${build.dist.dir}/lib"/>
      <copy todir="${build.dist.dir}/lib">
         <fileset dir="${lib.runtime.dir}" includes="**/*.jar"/>
      <path id="manifest.classpath.path">
         <fileset dir="${build.dist.dir}" includes="lib/**/*.jar"/>
      <pathconvert property="manifest.classpath.prop" pathsep=" ">
        <path refid="manifest.classpath.path"/>
      <jar destfile="${build.dist.dir}/${dist.jar.filename}">
         <fileset dir="${build.classes.dir}" includes="**/*.class"/>
            <attribute name="Built-By" value="${}"/>
            <attribute name="Main-Class" value="${project.main.class}"/>
            <attribute name="Class-Path" value="${manifest.classpath.prop}"/>


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

View raw message