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/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 100% 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 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-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties b/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties index ff865bccab9e..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,5 +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 bee59b4c035d..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 + @@ -63,13 +68,12 @@ under the License. org.slf4j slf4j-simple - ${slf4jVersion} jar sources false ${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 91% 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..a0ae41cff961 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; @@ -37,4 +37,9 @@ public Logger getLogger(String name) { return oldInstance == null ? newInstance : oldInstance; } } + + @Override + protected Logger createLogger(String name) { + return new MavenSimpleLogger(name); + } } 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..a6ab1d29c5de --- /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"; // !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..041b78404aac 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 @@ -374,7 +374,6 @@ under the License. org.slf4j slf4j-simple ${slf4jVersion} - true ch.qos.logback