On 2010-02-26, Knuplesch, Juergen <[email protected]> wrote:

> I do the following to get some special files into a jarfile (Applet):

> <jar destfile="${applet.jarname}" update="true" duplicate="preserve">
>         <fileset dir="${appletfix.include.dir}"></fileset>
> </jar>

This means that if your fileset contains several files of the same name,
only one would be added to your jar.  I wouldn't hope that you've
managed to have two files with the same name in a single directory,
though.

> <jar destfile="${applet.jarname}"
>         duplicate="preserve"
>         update="true">
> ....

should do exactly the same, but since you don't show us the ... this
time there is a chance you really have duplicate file names since there
might by multiple directory trees.

> There are two files in in both filesets that are added to the jar file.

Two different file names, yes?

Duplicates are entries that have the same file name inside the archive.

> Under Windows the first file is added to the jar in the first jar task
> and not changed with the second jar task.

> Under Linux we experience the opposite behaviour. The second file is
> added and the first deleted.

deleted?

> What does duplicate="preserve" exactly mean?

Means that if you are adding more than one archive entry with the same
name, keep the first one and discard all others.

> It is not explained in the docu. I found it out by testing.

This is true - unfortunately - it is not spelled out what the three
different choices for duplicate actually do.

My guess is that you have two files with the same names in your filesets
and they have different timestamps on Windows and Linux.  On Windows the
first file is more recent on Linux the second.  And since you are using
update="true" in both cases you get the one that has the more recent
timestamp locally.  It shouldn't matter what value the duplicate
attribute has in that case.

That being said a combination of an archive that already has multiple
entries with the same name (created with duplicate="add" or outside of
Ant) with update="true" is really asking for trouble, at least if one of
the entries is older than a local file and the other is not.  And even
if both are older, whoch one should Ant "update"?  A random one or both?

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to