Hi, all.

My jar target is starting to look combinatoric because I cannot see how 
to include an element selectively.  For example, I only want to specify 
a manifest if a main class if one is provided, and not otherwise.  Right 
now, it looks like:

   <target name="jar-manifest" if="jar.main-class">
     <jar
       jarfile="${jar.dist}/${jar.baseName}-${DSTAMP}.jar"
       basedir="${compile.classes}"
       <manifest>
         <attribute name="Main-Class" value="${jar.main-class}"/>
       </manifest>
     </jar>
   </target>

   <target name="jar-no-manifest" unless="jar.main-class">
     <jar
       jarfile="${jar.dist}/${jar.baseName}-${DSTAMP}.jar"
       basedir="${compile.classes}"
     />
   </target>

   <target name="jar" depends="jar-manifest, jar-no-manifest" 
description="Build jar" />

I do not mind this structure for a single property, but now I want to 
add in file and zip includes, and those may need the same "only if the 
property has a value" structure.

Is there a way to do:
   <target name="jar">
     <jar
       jarfile="${jar.dist}/${jar.baseName}-${DSTAMP}.jar"
       basedir="${compile.classes}"
       <manifest if="jar.main-class">
         <attribute name="Main-Class" value="${jar.main-class}"/>
       </manifest>
     </jar>
   </target>

or
       <manifest>
         <attribute name="Main-Class" value="${jar.main-class}" 
if="main.class"/>
       </manifest>

Were that latter possible, I could then do something like

       <manifest>
         <attribute name="Main-Class" value="${jar.main-class}" 
if="main.class"/>
         <attribute name="Build-Date" value="tstamp" />
         <attribute name="Build-Number" value="${build.number}" 
if="build.number"/>
       </manifest>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to