Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
Accessing the manifest within a jar file

Accessing the manifest within a jar file

2006-10-31       - By Matt Benson
Reply:     1     2     3     4     5     6     7     8     9  

--- "Ivan \"Rambius\" Ivanov"
<rambiusparkisanius@(protected)> wrote:

> Hello,
>
> You can also use Ant 1.7 zipentry resource:
>
> <zipentry zipfile="my.jar"
>    name="META-INF/MANIFEST.MF"/>


Thanks for the resource plug, Ivan.  :)
Alternatively, assuming ${jar} points to the relevant
jar file, you could use

<url url="jar:file:///${jar}!/META-INF/MANIFEST.MF" />

or

<javaresource name="META-INF/MANIFEST.MF"
classpath="${jar}" />

;)

Note that the <url>-based solution requires that the
${jar} property be an absolute path (not sure of the
rules regarding file: urls and relative paths).
Finally, I don't know if it's good or bad that there
are three resource-based ways to access a manifest,
but it's interesting, anyway.

-Matt

>
> Regards
> Ivan
>
> --- Antoine Levy-Lambert <antoine@(protected)> wrote:
>
> > Hello Michael,
> >
> > this is an interesting question.
> >
> > I would write my own custom Ant task . You can use
> > java.util.jar.JarFile
> > and java.util.jar.Manifest to access whathever
> > information you want.
> >
> > Actually, I am interested by the same sort of
> topic,
> > for instance to
> > collect Vendor/Version/Name information from a set
> > of jar files and
> > generate a report from this.
> >
> > Regards,
> >
> > Antoine
> >
> > Nau, Michael wrote:
> > > Anyone know of an easy way to access the
> manifest
> > file within a jar
> > > file? I realize I can extract the manifest first
> > using the <unjar> task,
> > > but I was hoping for a way to directly access
> the
> > manifest file.
> > >
> > > I need to check for some specific info within
> the
> > manifest of several
> > > jar files from my ant script.
> > >
> > > Thanks,
> > > -Mike
> > >
> > >
> > >
> > >  
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > user-unsubscribe@(protected)
> > For additional commands, e-mail:
> > user-help@(protected)
> >
> >
>
>
>
>  
>
_______________________________________________________________________________
_____
> Want to start your own business? Learn how on Yahoo!
> Small Business
> (http://smallbusiness.yahoo.com)
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)
>
>




_______________________________________________________________________________
___________
Check out the New Yahoo! Mail - Fire up a more powerful email and get things
done faster.
(http://advision.webevents.yahoo.com/mailbeta)


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.