ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Jar task blues
Date Wed, 07 Jul 2004 13:07:24 GMT
Seems like you covered most of the bases. Another approach, unsatisfactory
to some, is to first copy everything you want to zip in a temporary folder
where you want it, and then zip it. The copy can often be made more
flexibly, with mappers, executed conditionally, etc... You could also use
<sync>, which might be faster but is less flexible (no mappers). --DD

-----Original Message-----
From: Kevin Duffey
To: user@ant.apache.org
Sent: 7/6/2004 2:53 PM
Subject: Jar task blues

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="">
  <...
</zipfileset>
 
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"/>
</fileset>
 
 
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.
 
Thanks.
 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message