ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Duffey" <>
Subject Jar task blues
Date Tue, 06 Jul 2004 19:53:57 GMT
Hey all,
I am trying to build a jar file that may or may not have some dirs under the directory I want
to jar up. Some might have the config dir, some might not. I am using a taskdef loop that
I created which for brevity, just know that it works. It passes in each dir I want to jar
up as separate jars. Each dir passed in is the root dir. Below it I have classes, src, config,
lib and properties. The last three dirs are there some of the time, sometimes not. Using my
loop task, I can provide a comma separated list of paths to jar up so that I don't have to
write several <jar..> tasks. In fact, I use this loop in the compile, init, clean and
javadoc tags as well so I can simply add a path to this one property, and the entire build
process works. So far it all works except this issue with jarring.
The problem is, if the config, properties or lib dir is not present, the build fails. Now,
I have used patternset, used available and if checks and all that. It works for the most part,
but my main problem is, I want to include the /config, /properties and /lib stuff in the ROOT
dir of the jar file. If I do:
<zipfileset dir="${module.path.dir}/properties" prefix="">
this fails because if the /properties is NOT present, it breaks the build. <zipfileset,
doesn't support the if call directly. By using the <fileset> or <patternset> approach,
it almost works:
<available property="properties.present" type="dir" file="${module.path.dir}/properties"/>
<available property="config.present" type="dir" file="${module.path.dir}/config"/>
<fileset dir="${module.path.dir}">
  <include name="**/properties/**" if="properties.present"/>
  <include name="**/config/**" if="config.present"/>
Now, this works fine, but the files are found in the /config, and /properties inside the JAR.
which I can't have. I need them to be at the root but yet still ONLY included IF the dir they
reside at is present.
Can anyone provide some help on this? I seem to be almost there, just missing some key ingredient
to get it to work.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message