You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2020/06/27 21:02:24 UTC

[maven-war-plugin] branch MWAR-433 created (now 0e4ec9e)

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a change to branch MWAR-433
in repository https://gitbox.apache.org/repos/asf/maven-war-plugin.git.


      at 0e4ec9e  [MWAR-433] ignore files created after session start for outdated check

This branch includes the following new commits:

     new 0e4ec9e  [MWAR-433] ignore files created after session start for outdated check

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-war-plugin] 01/01: [MWAR-433] ignore files created after session start for outdated check

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch MWAR-433
in repository https://gitbox.apache.org/repos/asf/maven-war-plugin.git

commit 0e4ec9ebd6ee5001c22ef743d1f1e649526b64e0
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Sat Jun 27 23:02:16 2020 +0200

    [MWAR-433] ignore files created after session start for outdated check
---
 src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java     | 6 +++++-
 src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java | 6 +++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java b/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java
index 5595124..175d42b 100644
--- a/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java
@@ -646,7 +646,11 @@ public abstract class AbstractWarMojo
                         public FileVisitResult visitFile( Path file, BasicFileAttributes attrs )
                             throws IOException
                         {
-                            outdatedResources.add( webappDirectory.toPath().relativize( file ).toString() );
+                            if ( file.toFile().lastModified() < session.getStartTime().getTime() )
+                            {
+                                // resource older than session build start
+                                outdatedResources.add( webappDirectory.toPath().relativize( file ).toString() );
+                            }
                             return super.visitFile( file, attrs );
                         }
                     } );
diff --git a/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java b/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java
index 87344ad..9ec8ef9 100644
--- a/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java
@@ -21,6 +21,7 @@ package org.apache.maven.plugins.war;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.Date;
 import java.util.List;
 
 import org.apache.maven.execution.DefaultMavenExecutionRequest;
@@ -28,7 +29,6 @@ import org.apache.maven.execution.MavenExecutionRequest;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.plugin.testing.stubs.ArtifactStub;
-import org.apache.maven.plugins.war.AbstractWarMojo;
 import org.apache.maven.plugins.war.stub.MavenProjectBasicStub;
 import org.apache.maven.plugins.war.stub.WarOverlayStub;
 import org.apache.maven.shared.filtering.MavenFileFilter;
@@ -71,8 +71,8 @@ public abstract class AbstractWarMojoTest
         setVariableValueToObject( mojo, "mavenFileFilter", lookup( MavenFileFilter.class.getName() ) );
         setVariableValueToObject( mojo, "useJvmChmod", Boolean.TRUE );
 
-        MavenExecutionRequest request = new DefaultMavenExecutionRequest();
-        request.setSystemProperties( System.getProperties() );
+        MavenExecutionRequest request =
+            new DefaultMavenExecutionRequest().setSystemProperties( System.getProperties() ).setStartTime( new Date() );
 
         MavenSession mavenSession =
             new MavenSession( (PlexusContainer) null, (RepositorySystemSession) null, request, null );