ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Ellsworth <sc...@alodar.com>
Subject How do I create a manifest in build.xml?
Date Fri, 11 Jan 2002 23:41:45 GMT
Hi, all.

If I know the main class for a jar, I want to have a manifest that 
states it so java -jar will work.

If the property "manifest.main-class" is set, the jar should have a 
manifest with that class specified in the Main-Class section.

If not, the default manifest is fine.

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>

But how do I have the <manifest> elements of the jar task only happen 
if manifest.main-class is defined?

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