You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2020/06/20 08:40:18 UTC
[maven] 11/30: Removing the resumption data when a build succeeded.
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 037e49e8f2577d399e39970e4e7bef696c383522
Author: Martin Kanters <Ma...@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.