From 6e7ebaa3bff2b9b6b2effaf79274feaeed644d77 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 2 Apr 2026 20:21:14 +1000 Subject: [PATCH 1/5] Upgrade to slf4j 2.0.17 Signed-off-by: Olivier Lamy --- ....txt => unrecognized-slf4j-api-2.0.17.txt} | 3 - .../impl/Slf4jSimpleConfiguration.java | 2 +- .../MavenSlf4jSimpleFriend.java | 2 +- maven-slf4j-provider/pom.xml | 6 +- .../org/slf4j/impl/StaticLoggerBinder.java | 82 ------------------- .../{impl => simple}/MavenSimpleLogger.java | 2 +- .../MavenSimpleLoggerFactory.java | 2 +- .../simple/MavenSimpleServiceProvider.java | 71 ++++++++++++++++ .../org.slf4j.spi.SLF4JServiceProvider | 17 ++++ .../MavenSimpleLoggerTest.java | 2 +- pom.xml | 2 +- 11 files changed, 97 insertions(+), 94 deletions(-) rename apache-maven/src/main/appended-resources/licenses/{MIT-slf4j-api-1.7.36.txt => unrecognized-slf4j-api-2.0.17.txt} (99%) rename maven-embedder/src/main/java/org/slf4j/{impl => simple}/MavenSlf4jSimpleFriend.java (98%) delete mode 100644 maven-slf4j-provider/src/main/java/org/slf4j/impl/StaticLoggerBinder.java rename maven-slf4j-provider/src/main/java/org/slf4j/{impl => simple}/MavenSimpleLogger.java (99%) rename maven-slf4j-provider/src/main/java/org/slf4j/{impl => simple}/MavenSimpleLoggerFactory.java (98%) create mode 100644 maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleServiceProvider.java create mode 100644 maven-slf4j-provider/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider rename maven-slf4j-provider/src/test/java/org/slf4j/{impl => simple}/MavenSimpleLoggerTest.java (99%) diff --git a/apache-maven/src/main/appended-resources/licenses/MIT-slf4j-api-1.7.36.txt b/apache-maven/src/main/appended-resources/licenses/unrecognized-slf4j-api-2.0.17.txt similarity index 99% rename from apache-maven/src/main/appended-resources/licenses/MIT-slf4j-api-1.7.36.txt rename to apache-maven/src/main/appended-resources/licenses/unrecognized-slf4j-api-2.0.17.txt index 1a3d053237be..f687729a0b45 100644 --- a/apache-maven/src/main/appended-resources/licenses/MIT-slf4j-api-1.7.36.txt +++ b/apache-maven/src/main/appended-resources/licenses/unrecognized-slf4j-api-2.0.17.txt @@ -19,6 +19,3 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - - diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java index cf79b5c8ab1c..940d145e2880 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java @@ -20,7 +20,7 @@ import org.apache.maven.cli.logging.BaseSlf4jConfiguration; import org.slf4j.MavenSlf4jFriend; -import org.slf4j.impl.MavenSlf4jSimpleFriend; +import org.slf4j.simple.MavenSlf4jSimpleFriend; /** * Configuration for slf4j-simple. diff --git a/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java b/maven-embedder/src/main/java/org/slf4j/simple/MavenSlf4jSimpleFriend.java similarity index 98% rename from maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java rename to maven-embedder/src/main/java/org/slf4j/simple/MavenSlf4jSimpleFriend.java index b511094ec683..e27d85f003e7 100644 --- a/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java +++ b/maven-embedder/src/main/java/org/slf4j/simple/MavenSlf4jSimpleFriend.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.slf4j.impl; +package org.slf4j.simple; import org.slf4j.ILoggerFactory; import org.slf4j.LoggerFactory; diff --git a/maven-slf4j-provider/pom.xml b/maven-slf4j-provider/pom.xml index bee59b4c035d..3b93c7debe0c 100644 --- a/maven-slf4j-provider/pom.xml +++ b/maven-slf4j-provider/pom.xml @@ -66,10 +66,10 @@ under the License. ${slf4jVersion} jar sources - false + true ${project.build.directory}/generated-sources/slf4j-simple - org/slf4j/impl/*.java - org/slf4j/impl/StaticLoggerBinder* + org/slf4j/simple/*.java + org/slf4j/simple/SimpleServiceProvider* diff --git a/maven-slf4j-provider/src/main/java/org/slf4j/impl/StaticLoggerBinder.java b/maven-slf4j-provider/src/main/java/org/slf4j/impl/StaticLoggerBinder.java deleted file mode 100644 index 11956c91a8a2..000000000000 --- a/maven-slf4j-provider/src/main/java/org/slf4j/impl/StaticLoggerBinder.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.slf4j.impl; - -import org.slf4j.ILoggerFactory; -import org.slf4j.spi.LoggerFactoryBinder; - -/** - * SLF4J LoggerFactoryBinder implementation using MavenSimpleLogger. - * This class is part of the required classes used to specify an - * SLF4J logger provider implementation. - * - * @since 3.5.1 - */ -public final class StaticLoggerBinder implements LoggerFactoryBinder { - /** - * Declare the version of the SLF4J API this implementation is compiled - * against. The value of this field is usually modified with each release. - */ - // to avoid constant folding by the compiler, this field must *not* be final - @SuppressWarnings({"checkstyle:staticvariablename", "checkstyle:visibilitymodifier"}) - public static String REQUESTED_API_VERSION = "1.7.25"; // !final - - private static final String LOGGER_FACTORY_CLASS_STR = MavenSimpleLoggerFactory.class.getName(); - - /** - * The unique instance of this class. - */ - private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder(); - - /** - * The ILoggerFactory instance returned by the {@link #getLoggerFactory} - * method should always be the same object - */ - private final ILoggerFactory loggerFactory; - - /** - * Private constructor to prevent instantiation - */ - private StaticLoggerBinder() { - loggerFactory = new MavenSimpleLoggerFactory(); - } - - /** - * Returns the singleton of this class. - */ - public static StaticLoggerBinder getSingleton() { - return SINGLETON; - } - - /** - * Returns the factory. - */ - @Override - public ILoggerFactory getLoggerFactory() { - return loggerFactory; - } - - /** - * Returns the class name. - */ - @Override - public String getLoggerFactoryClassStr() { - return LOGGER_FACTORY_CLASS_STR; - } -} diff --git a/maven-slf4j-provider/src/main/java/org/slf4j/impl/MavenSimpleLogger.java b/maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleLogger.java similarity index 99% rename from maven-slf4j-provider/src/main/java/org/slf4j/impl/MavenSimpleLogger.java rename to maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleLogger.java index 0ef4d2f9af55..83516f834dd7 100644 --- a/maven-slf4j-provider/src/main/java/org/slf4j/impl/MavenSimpleLogger.java +++ b/maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleLogger.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.slf4j.impl; +package org.slf4j.simple; import java.io.PrintStream; diff --git a/maven-slf4j-provider/src/main/java/org/slf4j/impl/MavenSimpleLoggerFactory.java b/maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleLoggerFactory.java similarity index 98% rename from maven-slf4j-provider/src/main/java/org/slf4j/impl/MavenSimpleLoggerFactory.java rename to maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleLoggerFactory.java index 433d195ea719..b885db95528c 100644 --- a/maven-slf4j-provider/src/main/java/org/slf4j/impl/MavenSimpleLoggerFactory.java +++ b/maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleLoggerFactory.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.slf4j.impl; +package org.slf4j.simple; import org.slf4j.Logger; diff --git a/maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleServiceProvider.java b/maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleServiceProvider.java new file mode 100644 index 000000000000..41e44f935bd8 --- /dev/null +++ b/maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleServiceProvider.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.slf4j.simple; + +import org.slf4j.ILoggerFactory; +import org.slf4j.IMarkerFactory; +import org.slf4j.helpers.BasicMarkerFactory; +import org.slf4j.helpers.NOPMDCAdapter; +import org.slf4j.spi.MDCAdapter; +import org.slf4j.spi.SLF4JServiceProvider; + +/** + * SLF4J service provider for Maven, using {@link MavenSimpleLoggerFactory} + * to provide colorized log output. + * + * @since 3.10.0 + */ +public class MavenSimpleServiceProvider implements SLF4JServiceProvider { + + /** + * Declare the version of the SLF4J API this implementation is compiled against. + */ + // to avoid constant folding by the compiler, this field must *not* be final + @SuppressWarnings({"checkstyle:staticvariablename", "checkstyle:visibilitymodifier"}) + public static String REQUESTED_API_VERSION = "2.0.99"; // !final + + private ILoggerFactory loggerFactory; + private final IMarkerFactory markerFactory = new BasicMarkerFactory(); + private final MDCAdapter mdcAdapter = new NOPMDCAdapter(); + + @Override + public ILoggerFactory getLoggerFactory() { + return loggerFactory; + } + + @Override + public IMarkerFactory getMarkerFactory() { + return markerFactory; + } + + @Override + public MDCAdapter getMDCAdapter() { + return mdcAdapter; + } + + @Override + public String getRequestedApiVersion() { + return REQUESTED_API_VERSION; + } + + @Override + public void initialize() { + loggerFactory = new MavenSimpleLoggerFactory(); + } +} diff --git a/maven-slf4j-provider/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider b/maven-slf4j-provider/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider new file mode 100644 index 000000000000..0ba03ce1bb2d --- /dev/null +++ b/maven-slf4j-provider/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +org.slf4j.simple.MavenSimpleServiceProvider diff --git a/maven-slf4j-provider/src/test/java/org/slf4j/impl/MavenSimpleLoggerTest.java b/maven-slf4j-provider/src/test/java/org/slf4j/simple/MavenSimpleLoggerTest.java similarity index 99% rename from maven-slf4j-provider/src/test/java/org/slf4j/impl/MavenSimpleLoggerTest.java rename to maven-slf4j-provider/src/test/java/org/slf4j/simple/MavenSimpleLoggerTest.java index b18100eeee71..1d0aefe180c4 100644 --- a/maven-slf4j-provider/src/test/java/org/slf4j/impl/MavenSimpleLoggerTest.java +++ b/maven-slf4j-provider/src/test/java/org/slf4j/simple/MavenSimpleLoggerTest.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.slf4j.impl; +package org.slf4j.simple; import java.io.ByteArrayOutputStream; import java.io.PrintStream; diff --git a/pom.xml b/pom.xml index e0b72c0dda98..08fc1c8fd133 100644 --- a/pom.xml +++ b/pom.xml @@ -145,7 +145,7 @@ under the License. 2.0 1.4.0 2.0.16 - 1.7.36 + 2.0.17 2.11.0 2.0.9 true From 6dd4049ea503b3c706ede44aaee334f4f3ca6b58 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Tue, 7 Apr 2026 19:12:14 +1000 Subject: [PATCH 2/5] Fix some issue with upgrade Signed-off-by: Olivier Lamy --- README.md | 2 +- .../resources/META-INF/maven/slf4j-configuration.properties | 1 + maven-slf4j-provider/pom.xml | 3 +-- .../main/java/org/slf4j/simple/MavenSimpleServiceProvider.java | 2 +- pom.xml | 1 - 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d436ce017a2c..79a17cf0d5e9 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ If you want to bootstrap Maven, you'll need: - Maven 3.9.0 or later - Run Maven, specifying a location into which the completed Maven distro should be installed: ``` -mvn -DdistributionTargetDir="$HOME/app/maven/apache-maven-3.9.x-SNAPSHOT" clean package +mvn -DdistributionTargetDir="$HOME/app/maven/apache-maven-3.10.x-SNAPSHOT" clean package ``` diff --git a/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties b/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties index ff865bccab9e..9d659d85a669 100644 --- a/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties +++ b/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties @@ -19,5 +19,6 @@ # value = corresponding o.a.m.cli.logging.Slf4jConfiguration class org.slf4j.impl.SimpleLoggerFactory org.apache.maven.cli.logging.impl.Slf4jSimpleConfiguration org.slf4j.impl.MavenSimpleLoggerFactory org.apache.maven.cli.logging.impl.Slf4jSimpleConfiguration +org.slf4j.simple.MavenSimpleLoggerFactory org.apache.maven.cli.logging.impl.Slf4jSimpleConfiguration org.apache.logging.slf4j.Log4jLoggerFactory org.apache.maven.cli.logging.impl.Log4j2Configuration ch.qos.logback.classic.LoggerContext org.apache.maven.cli.logging.impl.LogbackConfiguration diff --git a/maven-slf4j-provider/pom.xml b/maven-slf4j-provider/pom.xml index 3b93c7debe0c..aecd0644513f 100644 --- a/maven-slf4j-provider/pom.xml +++ b/maven-slf4j-provider/pom.xml @@ -63,10 +63,9 @@ under the License. org.slf4j slf4j-simple - ${slf4jVersion} jar sources - true + false ${project.build.directory}/generated-sources/slf4j-simple org/slf4j/simple/*.java org/slf4j/simple/SimpleServiceProvider* diff --git a/maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleServiceProvider.java b/maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleServiceProvider.java index 41e44f935bd8..a6ab1d29c5de 100644 --- a/maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleServiceProvider.java +++ b/maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleServiceProvider.java @@ -38,7 +38,7 @@ public class MavenSimpleServiceProvider implements SLF4JServiceProvider { */ // to avoid constant folding by the compiler, this field must *not* be final @SuppressWarnings({"checkstyle:staticvariablename", "checkstyle:visibilitymodifier"}) - public static String REQUESTED_API_VERSION = "2.0.99"; // !final + public static String REQUESTED_API_VERSION = "2.0"; // !final private ILoggerFactory loggerFactory; private final IMarkerFactory markerFactory = new BasicMarkerFactory(); diff --git a/pom.xml b/pom.xml index 08fc1c8fd133..041b78404aac 100644 --- a/pom.xml +++ b/pom.xml @@ -374,7 +374,6 @@ under the License. org.slf4j slf4j-simple ${slf4jVersion} - true ch.qos.logback From ffcb69f49ceef30fa420f6846003b13f6b97eaa0 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Tue, 7 Apr 2026 21:00:13 +1000 Subject: [PATCH 3/5] reduce diff Signed-off-by: Olivier Lamy --- .../licenses/unrecognized-slf4j-api-2.0.17.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apache-maven/src/main/appended-resources/licenses/unrecognized-slf4j-api-2.0.17.txt b/apache-maven/src/main/appended-resources/licenses/unrecognized-slf4j-api-2.0.17.txt index f687729a0b45..1a3d053237be 100644 --- a/apache-maven/src/main/appended-resources/licenses/unrecognized-slf4j-api-2.0.17.txt +++ b/apache-maven/src/main/appended-resources/licenses/unrecognized-slf4j-api-2.0.17.txt @@ -19,3 +19,6 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + From cb12cd31b79497d99cf61b7d08c8442cc9617916 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Wed, 8 Apr 2026 15:41:58 +1000 Subject: [PATCH 4/5] add missing mapping Signed-off-by: Olivier Lamy --- .../resources/META-INF/maven/slf4j-configuration.properties | 1 + maven-slf4j-provider/pom.xml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties b/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties index 9d659d85a669..fe82931e5ba7 100644 --- a/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties +++ b/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties @@ -19,6 +19,7 @@ # value = corresponding o.a.m.cli.logging.Slf4jConfiguration class org.slf4j.impl.SimpleLoggerFactory org.apache.maven.cli.logging.impl.Slf4jSimpleConfiguration org.slf4j.impl.MavenSimpleLoggerFactory org.apache.maven.cli.logging.impl.Slf4jSimpleConfiguration +org.slf4j.simple.SimpleLoggerFactory org.apache.maven.cli.logging.impl.Slf4jSimpleConfiguration org.slf4j.simple.MavenSimpleLoggerFactory org.apache.maven.cli.logging.impl.Slf4jSimpleConfiguration org.apache.logging.slf4j.Log4jLoggerFactory org.apache.maven.cli.logging.impl.Log4j2Configuration ch.qos.logback.classic.LoggerContext org.apache.maven.cli.logging.impl.LogbackConfiguration diff --git a/maven-slf4j-provider/pom.xml b/maven-slf4j-provider/pom.xml index aecd0644513f..095fa3caff50 100644 --- a/maven-slf4j-provider/pom.xml +++ b/maven-slf4j-provider/pom.xml @@ -51,6 +51,11 @@ under the License. hamcrest test + + org.slf4j + slf4j-simple + test + From d7a919849ba98909a5f726f5e412b88d3fbf4c2e Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 16 Apr 2026 08:32:07 +1000 Subject: [PATCH 5/5] override createLogger Signed-off-by: Olivier Lamy --- .../main/java/org/slf4j/simple/MavenSimpleLoggerFactory.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleLoggerFactory.java b/maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleLoggerFactory.java index b885db95528c..a0ae41cff961 100644 --- a/maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleLoggerFactory.java +++ b/maven-slf4j-provider/src/main/java/org/slf4j/simple/MavenSimpleLoggerFactory.java @@ -37,4 +37,9 @@ public Logger getLogger(String name) { return oldInstance == null ? newInstance : oldInstance; } } + + @Override + protected Logger createLogger(String name) { + return new MavenSimpleLogger(name); + } }