maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r894355 - in /maven/maven-2/branches/maven-2.2.x: ./ maven-artifact-manager/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java
Date Tue, 29 Dec 2009 11:21:48 GMT
Author: bentmann
Date: Tue Dec 29 11:21:48 2009
New Revision: 894355

URL: http://svn.apache.org/viewvc?rev=894355&view=rev
Log:
[MNG-4368] DefaultArtifactInstaller should only overwrite files if timestamp has changed

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

Modified:
    maven/maven-2/branches/maven-2.2.x/   (props changed)
    maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java

Propchange: maven/maven-2/branches/maven-2.2.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Dec 29 11:21:48 2009
@@ -5,5 +5,5 @@
 /maven/components/branches/maven-2.1.x:751686,767628,767631,768817,768995,769010-769011
 /maven/components/trunk:572229,720001,721902,726845,729292,792073
 /maven/maven-2/branches/maven-2.2.x-MNG-4347:813112
-/maven/maven-3/trunk:894176
+/maven/maven-3/trunk:894114,894176
 /maven/sandbox/branches/maven/MNG-3379:678167

Modified: maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java
URL: http://svn.apache.org/viewvc/maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java?rev=894355&r1=894354&r2=894355&view=diff
==============================================================================
--- maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java
(original)
+++ maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java
Tue Dec 29 11:21:48 2009
@@ -93,10 +93,22 @@
                 destination.getParentFile().mkdirs();
             }
 
-            getLogger().info( "Installing " + source.getPath() + " to " + destination );
+            boolean copy =
+                !destination.exists() || "pom".equals( artifact.getType() )
+                    || source.lastModified() != destination.lastModified() || source.length()
!= destination.length();
+
+            if ( copy )
+            {
+                getLogger().info( "Installing " + source + " to " + destination );
+
+                FileUtils.copyFile( source, destination );
+                destination.setLastModified( source.lastModified() );
+            }
+            else
+            {
+                getLogger().info( "Skipped re-installing " + source + " to " + destination
+ ", seems unchanged" );
+            }
 
-            FileUtils.copyFileIfModified( source, destination );
-            
             // Now, we'll set the artifact's file to the one installed in the local repository,
             // to help avoid duplicate copy operations in the deployment step.
             if ( useArtifactFile )



Mime
View raw message