You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Allen Riddle <al...@gmail.com> on 2011/12/20 23:39:41 UTC

Modifying contents of jar file

All,

Does anyone have any idea how I can modify a the contents of a built jar?
 I have an asssembler project that creates 3 different zip files.  There is
a Spring application context file that I need to override for each archive.
 Any thoughts on how to best do this?  I'm currently looking into the unzip
method in conjunction with copying the file in question.  Thanks.

Re: Modifying contents of jar file

Posted by Olivier Lefevre <le...@yahoo.com>.
You need the ability to treat the jar as a writable virtual file system. Reportedly 

TrueZip and Java 7 can do that. See, e.g., 

http://docs.oracle.com/javase/7/docs/technotes/guides/io/fsp/zipfilesystemprovider.html

http://blogs.oracle.com/xuemingshen/entry/the_zip_filesystem_provider_in1




>________________________________
> From: Allen Riddle <al...@gmail.com>
>To: users@buildr.apache.org 
>Sent: Tuesday, December 20, 2011 11:39 PM
>Subject: Modifying contents of jar file
> 
>All,
>
>Does anyone have any idea how I can modify a the contents of a built jar?
>I have an asssembler project that creates 3 different zip files.  There is
>a Spring application context file that I need to override for each archive.
>Any thoughts on how to best do this?  I'm currently looking into the unzip
>method in conjunction with copying the file in question.  Thanks.
>