You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Bernd Donath <bd...@bd-net.de> on 2000/11/19 11:51:26 UTC

JAR target

Hi,

has anyone produced a JAR archive containing compressed AND uncompressed data 
(i.e GIFs) using the JAR or JLINK task? It seems as if the compress-Attribute 
does always affect the whole archive. Or is there a way to use the 
compress-Attr. with the fileset or pathelement tag?
I am using version: Ant version 1.2 compiled on October 24 2000 

Thanks, Bernd

Re: JAR target

Posted by Bernd Donath <bd...@bd-net.de>.
Hi,

What I want to do is similiar to updating a JAR archive as with the "jar uf0" command.

Here is a snippet from a MSDOS batch file that does exactly what I want to do with Ant:

echo creating java archive...
jar cvmf %PACKAGE%/alarmbrowser/%METAINFO% %TARGET% %PACKAGE%/alarmbrowser/*.class
jar uvf  %TARGET% %PACKAGE%/alarmbrowser/res/*.properties
jar uvf  %TARGET% %PACKAGE%/alarmbrowser/action/*.class
jar uvf0 %TARGET% %PACKAGE%/alarmbrowser/img/*.gif
jar uvf  %TARGET% %PACKAGE%/global/*.class

Here is my task that creates the JAR file with Ant:

<target name="alarmbrowser" depends="compile, init"> 		
  <copy todir="${buildDir}/${packagePath}/${packageAlarmBrowser}/img">
    <fileset dir="${sourceDir}/${packagePath}/${packageAlarmBrowser}/img">
      <include name="**/*.gif"/>
    </fileset>
  </copy>

  <copy todir="${buildDir}/${packagePath}/${packageAlarmBrowser}/res">
    <fileset dir="${sourceDir}/${packagePath}/${packageAlarmBrowser}/res">
      <include name="**/*.properties"/>
    </fileset>
  </copy>

  <jar jarfile="${targetDir}/${targetAlarmBrowser}" 
        basedir="${buildDir}"
        compress="false"
        includes="**/${packageAlarmBrowser}/, **/${packageGlobal}/"			           
        manifest="${sourceDir}/${packagePath}/${packageAlarmBrowser}/metainfo.mf">		
  </jar>		
</target>

When I use compress="true" then the GIF files become also compressed and cannot be 
loaded from the classpath afterwards (when running as applet). 

I would appreciate any suggestions or comments!

Thanks, Bernd


> Hi,
>
> has anyone produced a JAR archive containing compressed AND uncompressed
> data (i.e GIFs) using the JAR or JLINK task? It seems as if the
> compress-Attribute does always affect the whole archive. Or is there a way
> to use the compress-Attr. with the fileset or pathelement tag?
> I am using version: Ant version 1.2 compiled on October 24 2000
>
> Thanks, Bernd