ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: jar and isempty
Date Tue, 20 Dec 2005 05:11:48 GMT
On Tue, 20 Dec 2005, Kamal Bhatt <> wrote:

> I used whenempty="fail" and instead of failure I get a stupid
> message telling me that a jar file is never empty (because of the
> manifest file).

I wouldn't call it stupid ...

> Is there a way of making it work the way I expect it to work (ie
> failing when there are no files in the file set) instead of this
> rather unhelpful way?

Ant's svn contains a version of jar that can be made to not build the
jar at all - or fail, depending on an attribute.  So Ant 1.7 will work
as you'd like it to do.

This doesn't help you now.  The easiest workaround probably is to use
the <zip> task instead of the <jar> task and add the MANIFEST.MF in a
second step.  Something like

<tempfile property="zip" suffix=".zip"/>
<zip destfile="${zip}" whenempty="fail" encoding="UTF8">
<jar destfile="your-target-archive">
  <zipfileset src="${zip}"/>
<delete file="${zip}"/>


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

View raw message