maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject [41/50] git commit: [MNG-4368] DefaultArtifactInstaller should only overwrite files if timestamp has changed
Date Sat, 01 Dec 2012 10:39:58 GMT
[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-2/branches/maven-2.2.x@894355 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/eee384ef
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/eee384ef
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/eee384ef

Branch: refs/heads/maven-2.2.x
Commit: eee384ef9e93bd6c34e097b9ed6f49767d2ffe29
Parents: bde1763
Author: Benjamin Bentmann <bentmann@apache.org>
Authored: Tue Dec 29 11:21:48 2009 +0000
Committer: Benjamin Bentmann <bentmann@apache.org>
Committed: Tue Dec 29 11:21:48 2009 +0000

----------------------------------------------------------------------
 .../installer/DefaultArtifactInstaller.java        |   18 ++++++++++++--
 1 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/eee384ef/maven-artifact-manager/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java
----------------------------------------------------------------------
diff --git a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java
b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java
index 73eebd2..742dbec 100644
--- a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java
+++ b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java
@@ -93,10 +93,22 @@ public class DefaultArtifactInstaller
                 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