ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Ellsworth <sc...@alodar.com>
Subject Creating a manifest from a build.xml file
Date Fri, 04 Jan 2002 00:40:39 GMT
Hi, all.

If the property "manifest.main-class" is set, I want my jar to have 
that class specified in the Main-Class section of its manifest. 
Otherwise, I want it to just have the usual default manifest built.

Currently, my jar is build via:
   <target name="dist-debug" depends="compile-debug" 
description="Build debug jar">
     <jar
       jarfile="${dist}/${baseJarName}-${DSTAMP}-debug.jar"
       basedir="${build-debug}"
     />
   </target>

I believe the following will work to create the manifest if I always 
know that the property manifest.main.class is set

   <property name="manifest.file" value="manifest.mf"/>
   <property name="manifest.main.class" value="org.foo.dosomething"/>

   <target name="dist-debug-manifest" depends="compile-debug" 
description="Build debug jar with manifest">
     <jar
       jarfile="${dist}/${baseJarName}-${DSTAMP}-debug.jar"
       basedir="${build-debug}">
       <manifest>
         <attribute name="Main-Class" value="${manifest.main-class}"/>
       </manifest>
     </jar>
   </target>

I am not sure how to have the <manifest> section only happen if there 
is actually a manifest.

Does anyone else create a manifest on the fly this way?

Scott
-- 

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


Mime
View raw message