diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java index 26b4bcc531..9475493606 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java @@ -337,9 +337,9 @@ public class ExecutionEventLogger extends AbstractExecutionListener { File currentPom = project.getFile(); if (currentPom != null) { MavenSession session = event.getSession(); - Path topDirectory = session.getTopDirectory(); Path current = currentPom.toPath().toAbsolutePath().normalize(); - if (current.startsWith(topDirectory)) { + Path topDirectory = session.getTopDirectory(); + if (topDirectory != null && current.startsWith(topDirectory)) { current = topDirectory.relativize(current); } logger.info(" from " + current);