Skip to content

Commit

Permalink
[MNG-4368] DefaultArtifactInstaller should only overwrite files if ti…
Browse files Browse the repository at this point in the history
…mestamp 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
  • Loading branch information
bentmann committed Dec 27, 2009
1 parent fa63300 commit 9d13758
Showing 1 changed file with 13 additions and 1 deletion.
Expand Up @@ -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() )
Expand Down

0 comments on commit 9d13758

Please sign in to comment.