You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Daniel Hoppe <ho...@sitewaerts.de> on 2000/11/04 19:41:25 UTC

Add Manifest to existing jar

Hi,

does anyone have an idea how I can do a 

'jar ufm <my existing jarfile> <my manifest file>' 

with the jar task? I am using the weblogic.ejbc compiler which unfortunately
replaces my existing manifest file when generating stubs and skeletons
instead of adding new information. I wouldn't really mind unjaring and
rejaring the file to add the manifest, but I would have to merge my existing
manifest with the weblogic generated one.

I tried to use 		

<jar jarfile="<my existing jarfile>" manifest="<my manifest file" />

but that seems to be ignored.

Best Regards,

Daniel

PS: I recently switched to Ant1.2, it really rocks! The code readability is
much better - more nested arguments, it's really fun to work with (... in
terms of build files of course :)). To all contributors: Thank you so much,
it's a great tool and making things much easier for us!!

<<<<<<<<<<<<<<<<<<<<<<<<<<<
Daniel Hoppe
<sitewaerts> GmbH
Hebelstr. 15
76133 Karlsruhe
Germany

Tel.:  	+49 (721) 920 918 22
Fax:  	+49 (721) 920 918 29

mailto:hoppe@sitewaerts.de
http://www.sitewaerts.de
>>>>>>>>>>>>>>>>>>>>>>>>>>>
 

Re: Add Manifest to existing jar

Posted by Paul Arzul <pa...@exinet.co.za>.
On 6 Nov 2000, Stefan Bodewig wrote:

: >>>>> "DH" == Daniel Hoppe <ho...@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. :)


Re: Add Manifest to existing jar

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "DH" == Daniel Hoppe <ho...@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