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 <m...@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-unsubscr...@maven.apache.org
>>> For additional commands, e-mail: users-h...@maven.apache.org
>>>
>>>
>>>     
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> For additional commands, e-mail: users-h...@maven.apache.org
>>
>>
>>
>>   
>>     
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>
>
>   

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

Reply via email to