ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Ellsworth <>
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">

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=""/>
   <property name="manifest.main.class" value=""/>

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

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?


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message