You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Brian Fox <br...@infinity.nu> on 2010/05/01 04:55:15 UTC

Re: dependency:unpack handling of overwrite for individual items in the archive

Currently it just unpacks the whole archive.

On Thu, Apr 29, 2010 at 10:31 AM, Marshall Schor <ms...@schor.com> wrote:
> The documentation for dependency:unpack [1] says that the default is to
> overwrite (only) if newer.  But it seems to apply to the entire archive
> being unpacked, meaning that the check is on whether the archive file
> itself is "newer" or not, using what the plugin calls "marker files",
> and perhaps not on whether the individual archived items are newer or
> not (is that right?).
>
> Is it possible to specify overwrite-if-newer such that it applies to the
> timestamps on the individual zipped items in the source (I'm using zip
> as the archive format)?  Or is this the default behavior (for example,
> the Ant task for unZip [2] appears to have this property by default).
>
> -Marshall
>
> [1]
> http://maven.apache.org/plugins/maven-dependency-plugin/usage.html#Overwrite_Rules
> [2] http://ant.apache.org/manual/CoreTasks/unzip.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: dependency:unpack handling of overwrite for individual items in the archive

Posted by Brian Fox <br...@infinity.nu>.
No you're right, I was thinking of something else.

On Sat, May 8, 2010 at 3:26 PM, Marshall Schor <ms...@schor.com> wrote:
>
>
> On 5/1/2010 7:29 AM, Marshall Schor wrote:
>> Thanks, that saves me from doing another learning experiment :-)
>>
>
> I had occasion to check this while doing something else, and I found
> that it doesn't just unpack the whole archive.
>
> While doing the unpack, it iterates over each item in the archive, and
> runs this code in the class AbstractZipUnArchiver:
>
>    protected void extractFile( File srcF,
>                                File dir,
>                                InputStream compressedInputStream,
>                                String entryName,
>                                Date entryDate,
>                                boolean isDirectory, Integer mode )
>        throws IOException, ArchiverException
>    {
>        File f = FileUtils.resolveFile( dir, entryName );
>
>        try
>        {
>            if ( !isOverwrite() && f.exists() && ( f.lastModified() >=
> entryDate.getTime() ) )
>            {
>                return;
>
> This code checks *for each item in the zip* if the existing file's
> lastModified date is >= the zip entry's, and if so, it skips unzipping.
>
> And this is the behavior that I am seeing.  The version of this plexus
> Archiver code appears to be:
> AbstractZipUnArchiver.java 6650 2007-07-18 01:08:45Z jdcasey (My IDE
> (Eclipse) fetched it automagically...)
>
> This contradicts the response I had above, so please let me know if I'm
> missing something here...
>
> -Marshall
>
>
>> I think a workaround will be to run the antrun plugin -> unzip action to
>> do the unpacking, which is documented [1] to support a
>> replace-only-if-newer action on the individual parts as the default, and
>> also to pay attention to timezone issues in timestamps.
>>
>> -Marshall
>>
>> [1] http://ant.apache.org/manual/CoreTasks/unzip.html
>>
>> On 4/30/2010 10:55 PM, Brian Fox wrote:
>>
>>> Currently it just unpacks the whole archive.
>>>
>>> On Thu, Apr 29, 2010 at 10:31 AM, Marshall Schor <ms...@schor.com> wrote:
>>>
>>>
>>>> The documentation for dependency:unpack [1] says that the default is to
>>>> overwrite (only) if newer.  But it seems to apply to the entire archive
>>>> being unpacked, meaning that the check is on whether the archive file
>>>> itself is "newer" or not, using what the plugin calls "marker files",
>>>> and perhaps not on whether the individual archived items are newer or
>>>> not (is that right?).
>>>>
>>>> Is it possible to specify overwrite-if-newer such that it applies to the
>>>> timestamps on the individual zipped items in the source (I'm using zip
>>>> as the archive format)?  Or is this the default behavior (for example,
>>>> the Ant task for unZip [2] appears to have this property by default).
>>>>
>>>> -Marshall
>>>>
>>>> [1]
>>>> http://maven.apache.org/plugins/maven-dependency-plugin/usage.html#Overwrite_Rules
>>>> [2] http://ant.apache.org/manual/CoreTasks/unzip.html
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: dependency:unpack handling of overwrite for individual items in the archive

Posted by Marshall Schor <ms...@schor.com>.

On 5/1/2010 7:29 AM, Marshall Schor wrote:
> Thanks, that saves me from doing another learning experiment :-)
>   

I had occasion to check this while doing something else, and I found
that it doesn't just unpack the whole archive.

While doing the unpack, it iterates over each item in the archive, and
runs this code in the class AbstractZipUnArchiver:

    protected void extractFile( File srcF,
                                File dir,
                                InputStream compressedInputStream,
                                String entryName,
                                Date entryDate,
                                boolean isDirectory, Integer mode )
        throws IOException, ArchiverException
    {
        File f = FileUtils.resolveFile( dir, entryName );

        try
        {
            if ( !isOverwrite() && f.exists() && ( f.lastModified() >=
entryDate.getTime() ) )
            {
                return;

This code checks *for each item in the zip* if the existing file's
lastModified date is >= the zip entry's, and if so, it skips unzipping.

And this is the behavior that I am seeing.  The version of this plexus
Archiver code appears to be:
AbstractZipUnArchiver.java 6650 2007-07-18 01:08:45Z jdcasey (My IDE
(Eclipse) fetched it automagically...)

This contradicts the response I had above, so please let me know if I'm
missing something here...

-Marshall


> I think a workaround will be to run the antrun plugin -> unzip action to
> do the unpacking, which is documented [1] to support a
> replace-only-if-newer action on the individual parts as the default, and
> also to pay attention to timezone issues in timestamps.
>
> -Marshall
>
> [1] http://ant.apache.org/manual/CoreTasks/unzip.html
>
> On 4/30/2010 10:55 PM, Brian Fox wrote:
>   
>> Currently it just unpacks the whole archive.
>>
>> On Thu, Apr 29, 2010 at 10:31 AM, Marshall Schor <ms...@schor.com> wrote:
>>   
>>     
>>> The documentation for dependency:unpack [1] says that the default is to
>>> overwrite (only) if newer.  But it seems to apply to the entire archive
>>> being unpacked, meaning that the check is on whether the archive file
>>> itself is "newer" or not, using what the plugin calls "marker files",
>>> and perhaps not on whether the individual archived items are newer or
>>> not (is that right?).
>>>
>>> Is it possible to specify overwrite-if-newer such that it applies to the
>>> timestamps on the individual zipped items in the source (I'm using zip
>>> as the archive format)?  Or is this the default behavior (for example,
>>> the Ant task for unZip [2] appears to have this property by default).
>>>
>>> -Marshall
>>>
>>> [1]
>>> http://maven.apache.org/plugins/maven-dependency-plugin/usage.html#Overwrite_Rules
>>> [2] http://ant.apache.org/manual/CoreTasks/unzip.html
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>     
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>>   
>>     
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: dependency:unpack handling of overwrite for individual items in the archive

Posted by Marshall Schor <ms...@schor.com>.
Thanks, that saves me from doing another learning experiment :-)

I think a workaround will be to run the antrun plugin -> unzip action to
do the unpacking, which is documented [1] to support a
replace-only-if-newer action on the individual parts as the default, and
also to pay attention to timezone issues in timestamps.

-Marshall

[1] http://ant.apache.org/manual/CoreTasks/unzip.html

On 4/30/2010 10:55 PM, Brian Fox wrote:
> Currently it just unpacks the whole archive.
>
> On Thu, Apr 29, 2010 at 10:31 AM, Marshall Schor <ms...@schor.com> wrote:
>   
>> The documentation for dependency:unpack [1] says that the default is to
>> overwrite (only) if newer.  But it seems to apply to the entire archive
>> being unpacked, meaning that the check is on whether the archive file
>> itself is "newer" or not, using what the plugin calls "marker files",
>> and perhaps not on whether the individual archived items are newer or
>> not (is that right?).
>>
>> Is it possible to specify overwrite-if-newer such that it applies to the
>> timestamps on the individual zipped items in the source (I'm using zip
>> as the archive format)?  Or is this the default behavior (for example,
>> the Ant task for unZip [2] appears to have this property by default).
>>
>> -Marshall
>>
>> [1]
>> http://maven.apache.org/plugins/maven-dependency-plugin/usage.html#Overwrite_Rules
>> [2] http://ant.apache.org/manual/CoreTasks/unzip.html
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>     
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org