maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfscho...@apache.org
Subject [maven] 11/31: Removing the resumption data when a build succeeded.
Date Sat, 20 Jun 2020 09:33:24 GMT
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MNG-5760
in repository https://gitbox.apache.org/repos/asf/maven.git

commit f994d9076b91ea4af78ac408d39784b793a445a2
Author: Martin Kanters <Martin.Kanters@infosupport.com>
AuthorDate: Sat May 23 08:29:11 2020 +0200

    Removing the resumption data when a build succeeded.
---
 maven-core/src/main/java/org/apache/maven/DefaultMaven.java |  7 +++++++
 .../org/apache/maven/execution/BuildResumptionManager.java  | 13 +++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
index 026f729..4907ac9 100644
--- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
+++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
@@ -322,6 +322,13 @@ public class DefaultMaven
                 saveResumptionDataWhenApplicable( result, session );
                 return result;
             }
+            else
+            {
+                session.getAllProjects().stream()
+                        .filter( MavenProject::isExecutionRoot )
+                        .findFirst()
+                        .ifPresent( buildResumptionManager::removeResumptionData );
+            }
         }
         finally
         {
diff --git a/maven-core/src/main/java/org/apache/maven/execution/BuildResumptionManager.java
b/maven-core/src/main/java/org/apache/maven/execution/BuildResumptionManager.java
index 2e7e775..e0ab008 100644
--- a/maven-core/src/main/java/org/apache/maven/execution/BuildResumptionManager.java
+++ b/maven-core/src/main/java/org/apache/maven/execution/BuildResumptionManager.java
@@ -80,6 +80,19 @@ public class BuildResumptionManager
         applyResumptionProperties( request, properties );
     }
 
+    public void removeResumptionData( MavenProject rootProject )
+    {
+        Path resumeProperties = Paths.get( rootProject.getBuild().getDirectory(), RESUME_PROPERTIES_FILENAME
);
+        try
+        {
+            Files.deleteIfExists( resumeProperties );
+        }
+        catch ( IOException e )
+        {
+            logger.warn( "Could not delete " + RESUME_PROPERTIES_FILENAME + " file. ", e
);
+        }
+    }
+
     /**
      * A helper method to determine the value to resume the build with {@code -rf} taking
into account the edge case
      *   where multiple modules in the reactor have the same artifactId.


Mime
View raw message