ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Atherton <>
Subject Re: Access jar files in a library directory in the jar file
Date Tue, 18 Jun 2013 23:34:01 GMT
You are right that it is inefficient, but it is easy to understand. If 
you want to get efficient, you could create the main.jar with inclusions 
of <zipfileset>[1] using the src attribute for the other jars.

As for the manifest, while this would be tricky for a general purpose 
jar merging tool, it isn't a problem when you are creating a specific 
JAR file. Presumably Earl knows what the combined manifest should look like.


On 18/06/2013 11:53 AM, Earl Hood wrote:
> On Tue, Jun 18, 2013 at 11:54 AM, Bruce Atherton wrote:
>> It is fairly trivial to do. In your main jar target:
>>      1. create a temporary directory
>>      2. run the unjar task
>>      3. jar up your main jar, including the contents of the temporary
>> directory
>>      4. delete the temporary directory
> That is a way to do it, but it is inefficient and does not deal with
> manifest entries (which may or may not matter depending on your needs).
> Many moons ago, I wrote a java program to do jar merging, where it
> supports inclusion and exclusion expressions (so you can merge subsets
> of a jars) and attempts to also merge manifest entry information.  The
> program is efficient in that it does not pre-extract the jar files, but
> instead walks the jar structure when doing the merge.
> Never made it into an Ant task.  When I do need it, I just use the
> <java> task to call it.
> IIRC, at the time (many years ago) there was not much interest in such a
> facility of merging jars so I never packaged it up as an OSS project.
> --ewh
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message