所以除了那个强制的参数以外,就是看什么时候 isUptodate 为true,查看关键代码:
protected boolean isUptodate()
throws ArchiverException
{
final File zipFile = getDestFile();
final long destTimestamp = zipFile.lastModified();
if ( destTimestamp == 0 )
{
getLogger().debug( "isUp2date: false (Destination " + zipFile.getPath() + " not found.)" );
return false; // File doesn't yet exist
}
final Iterator it = resources.iterator();
if ( !it.hasNext() )
{
getLogger().debug( "isUp2date: false (No input files.)" );
return false; // No timestamp to compare
}
while ( it.hasNext() )
{
final Object o = it.next();
final long l;
if ( o instanceof ArchiveEntry )
{
l = ( (ArchiveEntry) o ).getResource()
.getLastModified();
}
else if ( o instanceof PlexusIoResourceCollection )
{
try
{
l = ( (PlexusIoResourceCollection) o ).getLastModified();
}
catch ( final IOException e )
{
throw new ArchiverException( e.getMessage(), e );
}
}
else
{
throw new IllegalStateException( "Invalid object type: " + o.getClass()
.getName() );
}
if ( l == PlexusIoResource.UNKNOWN_MODIFICATION_DATE )
{
// Don't know what to do. Safe thing is to assume not up2date.
getLogger().debug( "isUp2date: false (Resource with unknown modification date found.)" );
return false;
}
if ( l > destTimestamp )
{
getLogger().debug( "isUp2date: false (Resource with newer modification date found.)" );
return false;
}
}
getLogger().debug( "isUp2date: true" );
return true;
}
代码中提到有这么几个情况,会认为jar包不是最新的:
总结
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。