This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch maven-4.0.x in repository https://gitbox.apache.org/repos/asf/maven.git
commit d6382f6a93c995a1e2afbe00de7a49e37f5bf0b6 Author: Guillaume Nodet <[email protected]> AuthorDate: Tue Jun 23 07:19:56 2026 +0000 [#11683] Install JUL-to-SLF4J bridge to route java.util.logging through Maven logging Adds the jul-to-slf4j bridge so that libraries using java.util.logging (JUL) have their log output routed through SLF4J and Maven's logging system, instead of writing directly to stderr. Co-Authored-By: Claude Opus 4.6 <[email protected]> --- apache-maven/pom.xml | 7 +++++++ impl/maven-cli/pom.xml | 4 ++++ .../main/java/org/apache/maven/cling/invoker/LookupInvoker.java | 4 ++++ pom.xml | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml index 426bd70a67..dac0617fc9 100644 --- a/apache-maven/pom.xml +++ b/apache-maven/pom.xml @@ -70,6 +70,13 @@ under the License. <version>${slf4jVersion}</version> <scope>runtime</scope> </dependency> + <!-- bridge from java.util.logging (JUL) to SLF4J --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jul-to-slf4j</artifactId> + <version>${slf4jVersion}</version> + <scope>runtime</scope> + </dependency> <dependency> <groupId>org.apache.maven.resolver</groupId> <artifactId>maven-resolver-connector-basic</artifactId> diff --git a/impl/maven-cli/pom.xml b/impl/maven-cli/pom.xml index 72b4554c1c..9e9de4421e 100644 --- a/impl/maven-cli/pom.xml +++ b/impl/maven-cli/pom.xml @@ -195,6 +195,10 @@ under the License. <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jul-to-slf4j</artifactId> + </dependency> <dependency> <groupId>commons-cli</groupId> <artifactId>commons-cli</artifactId> diff --git a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupInvoker.java b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupInvoker.java index 5ec158321d..459f1046ef 100644 --- a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupInvoker.java +++ b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupInvoker.java @@ -90,6 +90,7 @@ import org.jline.terminal.impl.AbstractPosixTerminal; import org.jline.terminal.spi.TerminalExt; import org.slf4j.LoggerFactory; +import org.slf4j.bridge.SLF4JBridgeHandler; import org.slf4j.spi.LocationAwareLogger; import static java.util.Objects.requireNonNull; @@ -428,6 +429,9 @@ protected Consumer<String> doDetermineWriter(C context) { } protected void activateLogging(C context) throws Exception { + // Route java.util.logging (JUL) through SLF4J + SLF4JBridgeHandler.removeHandlersForRootLogger(); + SLF4JBridgeHandler.install(); context.slf4jConfiguration.activate(); if (context.options().failOnSeverity().isPresent()) { String logLevelThreshold = context.options().failOnSeverity().get(); diff --git a/pom.xml b/pom.xml index b65e8d4a1d..a193322e72 100644 --- a/pom.xml +++ b/pom.xml @@ -510,6 +510,11 @@ under the License. <version>${slf4jVersion}</version> <optional>true</optional> </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jul-to-slf4j</artifactId> + <version>${slf4jVersion}</version> + </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId>
