ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From patri...@exinet.co.za (Paul Arzul)
Subject Re: Add Manifest to existing jar
Date Mon, 06 Nov 2000 10:06:08 GMT
On 6 Nov 2000, Stefan Bodewig wrote:

: >>>>> "DH" == Daniel Hoppe <hoppe@sitewaerts.de> writes:
: 
:  DH> Hi, does anyone have an idea how I can do a
: 
:  DH> 'jar ufm <my existing jarfile> <my manifest file>'
: 
:  DH> I wouldn't really mind unjaring and rejaring the file to add the
:  DH> manifest, but I would have to merge my existing manifest with the
:  DH> weblogic generated one.
: 
: I'm afraid this is your only option. Probably <jlink> could be
: improved to help here (allowing you to leave out the unjar step, but
: it does ignore META-INF at the moment).
: 
: So what you need to do is to unjar your file, delete it, merge in your
: MANIFEST (which will need some special magic Ant doesn't provide yet)
: and rejar everything.
: 
: Stefan

i've managed to add a manifest to a merged jar, but without
manifest merging (since i don't need that.)

i've really needed the jar update feature, since i'm working
with a large static.jar (which takes forever to
unnecessarily rejar). needing to create multiple different
distributions - each containing the static.jar - takes up
50% of my build time.
 
note: this goes against the ant 1.2 documentation -
specifically the jlink documentation (including the last
online version i had a look at) - but it helped me, and so
i hope it helps you.

this assumes your manifest is placed in:

META-INF/MANIFEST.MF

the following snippet jars two output folders (build and
resource) into build.jar and then merges that with the large
static jar, naughtily supplying the manifest using addfiles.

(you will need ant 1.2 and the optional.jar in your lib
folder.)

hope that helps,

- p

---8<---

<?xml version="1.0"?>

<project name="Test" basedir=".">
  <!-- =================================================================== -->
  <!-- Creates a jar archive                                               -->
  <!-- =================================================================== -->
  <target name="jar" description="Creates a jar archive">
    <jar jarfile="build.jar">
      <fileset dir="build" />
      <fileset dir="resource" />
    </jar>

    <jlink compress="yes" outfile="merge.jar">
      <addfiles>
        <pathelement location="META-INF" />
      </addfiles>
      <mergefiles>
        <pathelement location="build.jar" />
        <pathelement location="static.jar" />
      </mergefiles>
    </jlink>
  </target>
</project>

--->8---

-- 
Please send email to me using plain text only. :)


Mime
View raw message