ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Glick <>
Subject Re: [Bug} jar Task
Date Thu, 07 Sep 2000 13:28:08 GMT
William Ferguson wrote:
> > Maybe we could emulate jar's original behavior (be actually looking
> > into the existing archive), but I'd make that an option as you don't
> > add _older_ files that frequently and it really means a huge
> > performance penalty.
> Thats sounds reasonable.

I don't think I understand what you are looking to get. The current
behavior, which is consistent with how <javac> and most other Ant tasks
work, is that it tries to bring things up to date, but otherwise avoid
extra work. Timestamps are used for this purpose; it assumes if you have
new stuff, the file will have been touched. In the unusual case that you
must add new files with an older timestamp, you do not need any special
support from the task. Just delete the JAR first and it will include

	<delete file="foo.jar"/>
	<jar jarfile="foo.jar" basedir="jarcontents"/>

Or "ant clean" occasionally and build from scratch. Examining the JAR
entries and their timestamps inside the JAR is also an option, but it
would probably take just as long to look, as to delete the JAR and make
it from scratch. The only advantage is if you had a lengthy and
time-consuming section of the build script which itself depended on the
JAR's timestamp, and you wanted to avoid rebuilding the remainder of the
targets in an incremental build unless the JAR really changed; and you
are either removing files from the JAR content area, or adding/changing
existing ones without affecting their timestamp. This really doesn't
sound like a typical use case to me, maybe you have experience

> But before I go down that path, can you confirm that the fileset
> attribute is effectively not used in Zip/Jar?

As Stefan said, yes they are used. To clarify: the inheritance from
MatchingTask is used if you write the task like this (the normal and
long-supported way):

	<jar jarfile="foo.jar" basedir="classes">
	  <include name="**/*.class"/>

A newer option is like this which uses FileSet's and references:

	<jar jarfile="foo.jar">
	  <fileset dir="classes"/>
	  <filesetref refid="fileset-shared-gif-images"/>

(Sort of like jar -C DIR FILE -C DIR FILE.)


Jesse Glick   <>
NetBeans, Open APIs  <>
tel (+4202) 3300-9161 Sun Micro x49161 Praha CR

View raw message