ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: Removing a file from .jar file
Date Fri, 05 May 2006 14:20:15 GMT
>I don't think you can delete the class file...but you can 
>certainly update the jar file with a new class or modified 
>class.  To delete, you will probably need to unjar, delete the 
>file in question and rejar...
>Leomar Costa wrote:
>>     Hi !
>>     How I can remove a file from a jar ? 

I dont know another way neither ... 
but you could define a macro for that.


<project default="test">

    <target name="prepare">
        <mkdir dir="zip"/>
        <echo file="zip/one.txt"   message="one"/>
        <echo file="zip/two.txt"   message="two"/>
        <echo file="zip/three.txt" message="three"/>
        <zip destfile="" basedir="zip"/>
        <delete dir="zip"/>

    <macrodef name="delFromZip">
        <attribute name="zip"/>
        <element   name="selectors" implicit="true" optional="true"/>
            <mkdir dir="__tmp__"/>
            <unzip dest="__tmp__" src="@{zip}"/>
            <delete file="@{zip}"/>
                <fileset dir="__tmp__">
            <zip destfile="@{zip}" basedir="__tmp__"/>
            <delete dir="__tmp__"/>

    <target name="test" depends="prepare">
        <delFromZip zip="">
            <include name="two.*"/> 


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

View raw message