[MNG-4368] DefaultArtifactInstaller should only overwrite files if timestamp has changed

o Revised to install upon any difference in file timestamp or length

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@894114 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-12-27 23:26:54 +00:00
parent fa6330023c
commit 9d137583dd
1 changed files with 13 additions and 1 deletions

View File

@ -82,7 +82,19 @@ public void install( File source, Artifact artifact, ArtifactRepository localRep
getLogger().info( "Installing " + source.getPath() + " to " + destination );
FileUtils.copyFileIfModified( source, destination );
boolean copy =
!destination.exists() || "pom".equals( artifact.getType() )
|| source.lastModified() != destination.lastModified() || source.length() != destination.length();
if ( copy )
{
FileUtils.copyFile( source, destination );
destination.setLastModified( source.lastModified() );
}
else
{
getLogger().debug( "Skipped re-installation of " + destination + ", seems unchanged" );
}
// must be after the artifact is installed
for ( ArtifactMetadata metadata : artifact.getMetadataList() )