You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Kazandjian Erik <Er...@siemens.atea.be> on 2001/06/26 09:06:09 UTC

Conditional include of manifest file

Hello,

I'm new to Ant and I'm trying to automate the creation of our jar files in a
project. Some of these files must have a hand-made manifest.mf file added to
them and others can do with the standard manifest files. I already managed
to work with conditional target execution to verify if a handmade
manifest.mf file exists or not and include it in my jar file, but this
forces me to create 3 targets to create one jar file. One target to check if
the manifest exists and set a property, one to build the jar file without
the manifest and one to build the jar file without. Is there a way to
specify the an if-clause on the manifest attribute of the jar command ?

I tried the following

<jar jarfile="..." ... >
 <manifest="my_src/ejb/META-INF/MANIFEST.MF" if="manifest.exists">
 ...
</jar>

but then I always get an error saying

Whitespace required before attributes. Has anyone tried this before ?

Erik 


Erik Kazandjian - Software Engineer
Siemens Atea IC D AS B5
++32 14 252962
e-mail : erik.kazandjian@siemens.atea.be



Re: Conditional include of manifest file

Posted by Stefan Bodewig <bo...@apache.org>.
Kazandjian Erik <Er...@siemens.atea.be> wrote:

> Is there a way to specify the an if-clause on the manifest attribute
> of the jar command ?

No, there is not, sorry.

> <jar jarfile="..." ... >
>  <manifest="my_src/ejb/META-INF/MANIFEST.MF" if="manifest.exists">
>  ...
> </jar>
> 
> but then I always get an error saying
> 
> Whitespace required before attributes.

This is because the above is not legal XML.

manifest is an attribute of jar, not a child element (in XML speak) -
and even if it was, the name of the element (manifest in your case)
had to be followed by a space - the equals sign follows names of
attributes.

Stefan