ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francis Galiegue <...@one2team.com>
Subject Re: Ant Task to read directly from a JAR Manifest file
Date Fri, 12 Dec 2008 12:24:06 GMT
Le vendredi 12 décembre 2008, Ghadi Mahmoudi a écrit :
> Hello,
> 
> Is there alread a Task, which is able to read values from manifest file
> (in a JAR)?
> 
> I prefer to avoid the long way of 1. unzip the JAR and 2. read the
> value.
> 
> thanks,
> 

Not directly, but why not just make a macro? Like in (NOTE: this example makes 
use of ant-contrib, for <var>):

<property name="tmpdir" location="some/where/under/basedir"/>
<var name="value-from-manifest"/>

<macrodef name="read-from-manifest">
	<attribute name="jar"/>
	<attribute name="attr"/>
	<sequential>
		<unjar src="@{jar}" dest="${tmpdir}">
			<patternset includes="META-INF/MANIFEST.MF"/>
		</unjar>
		<!--
			Then do what's necessary to fill $value-from-manifest
			with the value of @attr; the manifest will be in
			${tmpdir}/META-INF/MANIFEST.MF
		-->
	</sequential>
</macrodef>

-- 
Francis Galiegue
ONE2TEAM
Ingénieur système
Mob : +33 (0) 6 83 87 78 75
Tel : +33 (0) 1 78 94 55 52
fge@one2team.com
40 avenue Raymond Poincaré
75116 Paris

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message