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

o Improved logging to make optimization visible to end-user

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@894349 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-12-29 10:58:04 +00:00
parent 9121bccc93
commit 02e2e6664c
1 changed files with 3 additions and 3 deletions

View File

@ -80,20 +80,20 @@ public class DefaultArtifactInstaller
destination.getParentFile().mkdirs(); destination.getParentFile().mkdirs();
} }
getLogger().info( "Installing " + source.getPath() + " to " + destination );
boolean copy = boolean copy =
!destination.exists() || "pom".equals( artifact.getType() ) !destination.exists() || "pom".equals( artifact.getType() )
|| source.lastModified() != destination.lastModified() || source.length() != destination.length(); || source.lastModified() != destination.lastModified() || source.length() != destination.length();
if ( copy ) if ( copy )
{ {
getLogger().info( "Installing " + source + " to " + destination );
FileUtils.copyFile( source, destination ); FileUtils.copyFile( source, destination );
destination.setLastModified( source.lastModified() ); destination.setLastModified( source.lastModified() );
} }
else else
{ {
getLogger().debug( "Skipped re-installation of " + destination + ", seems unchanged" ); getLogger().info( "Skipped re-installing " + source + " to " + destination + ", seems unchanged" );
} }
// must be after the artifact is installed // must be after the artifact is installed