You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sn...@apache.org on 2007/02/04 11:43:18 UTC

svn commit: r503380 - /maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java

Author: snicoll
Date: Sun Feb  4 02:43:18 2007
New Revision: 503380

URL: http://svn.apache.org/viewvc?view=rev&rev=503380
Log:
MEAR-58: a module is now copied over only if it is newer than the destination file
Submitted by: Ian Springer
Reviewed by: Stephane Nicoll

Modified:
    maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java

Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java?view=diff&rev=503380&r1=503379&r2=503380
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java Sun Feb  4 02:43:18 2007
@@ -189,8 +189,9 @@
             for ( Iterator iter = getModules().iterator(); iter.hasNext(); )
             {
                 EarModule module = (EarModule) iter.next();
-                if (module instanceof JavaModule) {
-                    getLog().warn( "JavaModule is deprecated ("+module+"), please use JarModule instead.");
+                if ( module instanceof JavaModule )
+                {
+                    getLog().warn( "JavaModule is deprecated (" + module + "), please use JarModule instead." );
                 }
                 final File sourceFile = module.getArtifact().getFile();
                 final File destinationFile = buildDestinationFile( getWorkDirectory(), module.getUri() );
@@ -200,9 +201,10 @@
                         "; Did you package/install " + module.getArtifact() + "?" );
                 }
 
-                if (destinationFile.getCanonicalPath().equals(sourceFile.getCanonicalPath()))
+                if ( destinationFile.getCanonicalPath().equals( sourceFile.getCanonicalPath() ) )
                 {
-                    getLog().info( "Skipping artifact[" + module + "], as it already exists at[" + module.getUri() + "]" );
+                    getLog().info(
+                        "Skipping artifact[" + module + "], as it already exists at[" + module.getUri() + "]" );
                     continue;
                 }
 
@@ -219,8 +221,16 @@
                 }
                 else
                 {
-                    getLog().info( "Copying artifact[" + module + "] to[" + module.getUri() + "]" );
-                    FileUtils.copyFile( module.getArtifact().getFile(), destinationFile );
+                    if ( sourceFile.lastModified() > destinationFile.lastModified() )
+                    {
+                        getLog().info( "Copying artifact[" + module + "] to[" + module.getUri() + "]" );
+                        FileUtils.copyFile( sourceFile, destinationFile );
+                    }
+                    else
+                    {
+                        getLog().debug( "Skipping artifact[" + module + "], as it is already up to date at[" +
+                            module.getUri() + "]" );
+                    }
                 }
             }
         }