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

gnodet pushed a commit to branch maven-clean-plugin-4.x
in repository https://gitbox.apache.org/repos/asf/maven-clean-plugin.git


The following commit(s) were added to refs/heads/maven-clean-plugin-4.x by this 
push:
     new 2df5489  fix: log debug message when root directory is unavailable in 
fast clean fallback (#364)
2df5489 is described below

commit 2df5489d30cd864a340c27f48f52711a80599ac7
Author: Guillaume Nodet <[email protected]>
AuthorDate: Tue Nov 17 13:46:20 2026 +0100

    fix: log debug message when root directory is unavailable in fast clean 
fallback (#364)
    
    When session.getRootDirectory() throws IllegalStateException (embedded 
usage),
    log a debug message before falling back to the system temp directory.
    Also initialise rootDir to null explicitly for clarity.
    
    Addresses review feedback from @desruisseaux on #362.
    
    Co-authored-by: Guillaume Nodet <[email protected]>
---
 src/main/java/org/apache/maven/plugins/clean/CleanMojo.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/clean/CleanMojo.java 
b/src/main/java/org/apache/maven/plugins/clean/CleanMojo.java
index 0db1b3f..89cad6b 100644
--- a/src/main/java/org/apache/maven/plugins/clean/CleanMojo.java
+++ b/src/main/java/org/apache/maven/plugins/clean/CleanMojo.java
@@ -283,11 +283,12 @@ public class CleanMojo implements 
org.apache.maven.api.plugin.Mojo {
         if (fast && session != null) {
             Path tmpDir = fastDir;
             if (tmpDir == null) {
-                Path rootDir;
+                Path rootDir = null;
                 try {
                     rootDir = session.getRootDirectory();
                 } catch (IllegalStateException e) {
-                    rootDir = null;
+                    // Embedded usage where no root directory is available — 
fall through to fallback.
+                    logger.debug("Missing root directory, falling back to 
system temp directory.", e);
                 }
                 tmpDir = rootDir != null
                         ? 
rootDir.resolve(".mvn").resolve("target").resolve("clean")

Reply via email to