You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Knuplesch, Juergen" <Ju...@icongmbh.de> on 2010/02/26 14:32:19 UTC
Jar and duplicate=preserve
Hello,
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>
<jar destfile="${applet.jarname}"
duplicate="preserve"
update="true">
....
There are two files in in both filesets that are added to the jar file.
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.
Is this possible?
What does duplicate="preserve" exactly mean?
It is not explained in the docu. I found it out by testing.
Greetings Juergen
--
Jürgen Knuplesch
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Jar and duplicate=preserve
Posted by Stefan Bodewig <bo...@apache.org>.
On 2010-02-26, Knuplesch, Juergen <Ju...@icongmbh.de> 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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: AW: Jar and duplicate=preserve
Posted by Matt Benson <gu...@gmail.com>.
Sorry about that--per Stefan's email, it is duplicates="add" that has
the behavior I described. :)
-Matt
On Feb 26, 2010, at 9:37 AM, Knuplesch, Juergen wrote:
> Hello,
>
> Thabks for the replies.
>
> I could now reproduce this behaviour under Windows, because I have
> now the environment copied from Linux to Windows.
> And it happened also!!!
>
> But I also had the correct (for me) behaviour tested today under
> other circumstances.
>
> I do not understand this and keep on debugging and trying.
>
> Juergen
>
> --
> Jürgen Knuplesch www.icongmbh.de
> icon Sy
> -----Ursprüngliche Nachricht-----
> Von: Matt Benson [mailto:gudnabrsam@gmail.com]
> Gesendet: Freitag, 26. Februar 2010 16:29
> An: Ant Users List
> Betreff: Re: Jar and duplicate=preserve
>
> I think duplicate="preserve" actually implies that both entries are
> retained, per the ability of the format to handle this seemingly
> illogical situation.
>
> -Matt
>
> On Feb 26, 2010, at 9:21 AM, Antoine Levy Lambert wrote:
>
>> Hello Juergen,
>>
>> my spontaneous answer is that duplicate="preserve" means that if a
>> jar/zip entry is encountered a second time, the original is
>> preserved,
>> the second instance is not used, and no error message is displayed.
>> This might be in the documentation of the zip task. jar is an
>> extension of zip.
>>
>> Therefore, the behavior under linux would be a bug of Ant's packaging
>> tasks.
>>
>> Regards,
>>
>> Antoine
>>
>>
>> Knuplesch, Juergen wrote:
>>> Hello,
>>>
>>> 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>
>>> <jar destfile="${applet.jarname}" duplicate="preserve"
>>> update="true">
>>> ....
>>>
>>> There are two files in in both filesets that are added to the jar
>>> file.
>>>
>>> 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.
>>>
>>> Is this possible? What does duplicate="preserve" exactly mean?
>>> It is not explained in the docu. I found it out by testing.
>>>
>>> Greetings Juergen
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For
>> additional
>> commands, e-mail: user-help@ant.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For
> additional commands, e-mail: user-help@ant.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
AW: Jar and duplicate=preserve
Posted by "Knuplesch, Juergen" <Ju...@icongmbh.de>.
Hello,
Thabks for the replies.
I could now reproduce this behaviour under Windows, because I have now the environment copied from Linux to Windows.
And it happened also!!!
But I also had the correct (for me) behaviour tested today under other circumstances.
I do not understand this and keep on debugging and trying.
Juergen
--
Jürgen Knuplesch www.icongmbh.de
icon Sy
-----Ursprüngliche Nachricht-----
Von: Matt Benson [mailto:gudnabrsam@gmail.com]
Gesendet: Freitag, 26. Februar 2010 16:29
An: Ant Users List
Betreff: Re: Jar and duplicate=preserve
I think duplicate="preserve" actually implies that both entries are retained, per the ability of the format to handle this seemingly illogical situation.
-Matt
On Feb 26, 2010, at 9:21 AM, Antoine Levy Lambert wrote:
> Hello Juergen,
>
> my spontaneous answer is that duplicate="preserve" means that if a
> jar/zip entry is encountered a second time, the original is preserved,
> the second instance is not used, and no error message is displayed.
> This might be in the documentation of the zip task. jar is an
> extension of zip.
>
> Therefore, the behavior under linux would be a bug of Ant's packaging
> tasks.
>
> Regards,
>
> Antoine
>
>
> Knuplesch, Juergen wrote:
>> Hello,
>>
>> 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>
>> <jar destfile="${applet.jarname}" duplicate="preserve"
>> update="true">
>> ....
>>
>> There are two files in in both filesets that are added to the jar
>> file.
>>
>> 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.
>>
>> Is this possible? What does duplicate="preserve" exactly mean?
>> It is not explained in the docu. I found it out by testing.
>>
>> Greetings Juergen
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
> commands, e-mail: user-help@ant.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Jar and duplicate=preserve
Posted by Matt Benson <gu...@gmail.com>.
I think duplicate="preserve" actually implies that both entries are
retained, per the ability of the format to handle this seemingly
illogical situation.
-Matt
On Feb 26, 2010, at 9:21 AM, Antoine Levy Lambert wrote:
> Hello Juergen,
>
> my spontaneous answer is that duplicate="preserve" means that if a
> jar/zip entry is encountered a second time, the original is
> preserved, the second instance is not used, and no error message is
> displayed. This might be in the documentation of the zip task. jar
> is an extension of zip.
>
> Therefore, the behavior under linux would be a bug of Ant's
> packaging tasks.
>
> Regards,
>
> Antoine
>
>
> Knuplesch, Juergen wrote:
>> Hello,
>>
>> 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>
>> <jar destfile="${applet.jarname}" duplicate="preserve"
>> update="true">
>> ....
>>
>> There are two files in in both filesets that are added to the jar
>> file.
>>
>> 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.
>>
>> Is this possible? What does duplicate="preserve" exactly mean?
>> It is not explained in the docu. I found it out by testing.
>>
>> Greetings Juergen
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Jar and duplicate=preserve
Posted by Antoine Levy Lambert <an...@gmx.de>.
Hello Juergen,
my spontaneous answer is that duplicate="preserve" means that if a
jar/zip entry is encountered a second time, the original is preserved,
the second instance is not used, and no error message is displayed. This
might be in the documentation of the zip task. jar is an extension of zip.
Therefore, the behavior under linux would be a bug of Ant's packaging tasks.
Regards,
Antoine
Knuplesch, Juergen wrote:
> Hello,
>
> 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>
>
> <jar destfile="${applet.jarname}"
> duplicate="preserve"
> update="true">
> ....
>
> There are two files in in both filesets that are added to the jar file.
>
> 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.
>
> Is this possible?
> What does duplicate="preserve" exactly mean?
> It is not explained in the docu. I found it out by testing.
>
> Greetings Juergen
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org