ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hendrik Maryns <>
Subject Can I rename a file when jarring it?
Date Wed, 22 Oct 2008 09:31:37 GMT

I create a jar with some of my own files and another jar as zipfileset.
 I’d like one of the files of the other jar (which I do not produce) to
be renamed on the fly.  Is this possible?

What I have:

<target name="jar" depends="build" description="Make a jar file">
  <jar destfile="${releasedir}/${name}.jar" manifestencoding="UTF-8">
    <attribute name="Main-Class"
           value="de.uni_tuebingen.sfb.lichtenstein.main.MonaSearch" />
    <attribute name="Class-Path" value="." />
    <attribute name="Implementation-Title" value="${name}" />
    <attribute name="Implementation-Version" value="${version}" />
 	<metainf dir="${releasedir}" includes="COPYING,AUTHORS,THANKS" />
  	<zipfileset dir="${bindir}" excludes="**/tests/*,Mona/*" />
<!-- note “dir”-->
  	<zipfileset src="commons-cli-2.0-SNAPSHOT.jar"
               excludes="META-INF/*.SF,META-INF/LICENSE.txt" />
<!-- note “src”, see>
  <signjar jar="${releasedir}/${name}.jar"
           keypass="monasearch" />

Regarding the two comments: the error messages emitted by Ant are not
really helpful, it took me quite some googling around before I noticed
that I had a ‘src’ in the first case, the error message ‘the archive
can't be a directory’ is, like, not helpful at all.

Another very unhelpful error message was ‘only single argument resource
collections are supported as archives’ which was caused because I had a
<fileset> inside of <meta-inf>.  Here the documentation could be made
better: it just says ‘The nested metainf element specifies a FileSet.’
I interpreted that as that is should contain a FileSet.

Is a developer reading this, or should I create bugs all around?

Hendrik Maryns
Ask smart questions, get good answers:

View raw message