ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremy Nix" <>
Subject RE: Need help including empty directories in WAR task (or Zip/JAR/TAR)
Date Tue, 09 Dec 2003 13:43:31 GMT
Stefan, you brought up an interesting point that I may have to consider.
Notice that you touched a file (which creates a file) in the empty
directory.  The directory now has contents, thus is included in the
fileset.  When you remove that touch command, all directories are empty
(without files), and the war command contains nothing but the web.xml
that you specified.  Is that my only option to include empty
directories...that is, create a dummy file in them so that they aren't
actually empty?

Jeremy Nix
Southwest Financial Services, LTD.
(513) 621-6699 ext.1158

-----Original Message-----
From: Stefan Bodewig [] 
Sent: Tuesday, December 09, 2003 3:04 AM
Subject: Re: Need help including empty directories in WAR task (or

On Mon, 8 Dec 2003, Jeremy Nix <> wrote:

> I've been trying to figure out how to include an empty directory into 
> a fileset based task for months now.

I've kept all (now four) of your messages on this subject in order to
look into it.  Sorry, somehow I never manage to get far enough down on
my TODO list.  I know that it works for me.


[bodewig@bodewig bodewig]$ cat /tmp/war.xml 
  <mkdir dir="test-setup/a/b/c"/>
  <mkdir dir="test-setup/d"/>
  <touch file="test-setup/a/b/c/e"/>
  <war destfile="test.war" webxml="${ant.file}">
    <fileset dir="test-setup"/>
[bodewig@bodewig bodewig]$ ant -f /tmp/war.xml 
Buildfile: /tmp/war.xml
    [mkdir] Created dir: /tmp/test-setup/a/b/c
    [mkdir] Created dir: /tmp/test-setup/d
    [touch] Creating /tmp/test-setup/a/b/c/e
      [war] Building war: /tmp/test.war

Total time: 2 seconds
[bodewig@bodewig bodewig]$ zip -Tv /tmp/test.war 
Archive:  /tmp/test.war
    testing: META-INF/                OK
    testing: META-INF/MANIFEST.MF     OK
    testing: a/                       OK
    testing: a/b/                     OK
    testing: a/b/c/                   OK
    testing: d/                       OK
    testing: a/b/c/e                  OK
    testing: WEB-INF/                 OK
    testing: WEB-INF/web.xml          OK
No errors detected in compressed data of /tmp/test.war.
test of /tmp/test.war OK

You see, d is included even though it is empty.  This is Ant 1.6,


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

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

View raw message