This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven.git
commit c1cd0c0dc117dc53a7614c47dd2c87632616a8f8 Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Fri Nov 29 14:29:40 2024 +0100 Fix deprecation warnings --- .../org/apache/maven/ArtifactFilterManager.java | 2 ++ .../maven/repository/DefaultMirrorSelector.java | 1 + .../main/java/org/apache/maven/cli/MavenCli.java | 35 +++++++++++----------- .../maven/cli/CLIManagerDocumentationTest.java | 1 + .../apache/maven/cli/CLIReportingUtilsTest.java | 1 + .../org/apache/maven/cli/CleanArgumentTest.java | 1 + .../java/org/apache/maven/cli/MavenCliTest.java | 1 + .../maven/cli/event/ExecutionEventLoggerTest.java | 1 + .../maven/cli/props/MavenPropertiesLoaderTest.java | 1 + .../maven/cli/props/MavenPropertiesTest.java | 1 + .../transfer/ConsoleMavenTransferListenerTest.java | 1 + .../maven/cli/transfer/FileSizeFormatTest.java | 1 + .../cli/transfer/SimplexTransferListenerTest.java | 1 + 13 files changed, 30 insertions(+), 18 deletions(-) diff --git a/compat/maven-compat/src/main/java/org/apache/maven/ArtifactFilterManager.java b/compat/maven-compat/src/main/java/org/apache/maven/ArtifactFilterManager.java index e756a9ce4a..bb101cce0b 100644 --- a/compat/maven-compat/src/main/java/org/apache/maven/ArtifactFilterManager.java +++ b/compat/maven-compat/src/main/java/org/apache/maven/ArtifactFilterManager.java @@ -34,6 +34,7 @@ public interface ArtifactFilterManager { * @deprecated use {@code META-INF/maven/extension.xml} to define artifacts exported by Maven core and plugin * extensions. */ + @Deprecated ArtifactFilter getArtifactFilter(); /** @@ -50,6 +51,7 @@ public interface ArtifactFilterManager { * @deprecated use {@code META-INF/maven/extension.xml} to define artifacts exported by Maven core and plugin * extensions. */ + @Deprecated void excludeArtifact(String artifactId); Set<String> getCoreArtifactExcludes(); diff --git a/compat/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java b/compat/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java index fc8361c993..7cc34f53cc 100644 --- a/compat/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java +++ b/compat/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java @@ -34,6 +34,7 @@ import org.apache.maven.settings.Mirror; */ @Named @Singleton +@Deprecated public class DefaultMirrorSelector implements MirrorSelector { private static final String WILDCARD = "*"; diff --git a/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 70388bf326..5187a07774 100644 --- a/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -131,11 +131,6 @@ import org.slf4j.LoggerFactory; import static java.util.Comparator.comparing; import static org.apache.maven.api.Constants.MAVEN_HOME; import static org.apache.maven.api.Constants.MAVEN_INSTALLATION_CONF; -import static org.apache.maven.cli.CLIManager.BATCH_MODE; -import static org.apache.maven.cli.CLIManager.COLOR; -import static org.apache.maven.cli.CLIManager.FORCE_INTERACTIVE; -import static org.apache.maven.cli.CLIManager.NON_INTERACTIVE; -import static org.apache.maven.cli.ResolveFile.resolveFile; // TODO push all common bits back to plexus cli and prepare for transition to Guice. We don't need 50 ways to make CLIs @@ -488,7 +483,7 @@ public class MavenCli { // LOG COLOR String styleColor = cliRequest.getUserProperties().getProperty("style.color", "auto"); styleColor = cliRequest.getUserProperties().getProperty(Constants.MAVEN_STYLE_COLOR_PROPERTY, styleColor); - styleColor = commandLine.getOptionValue(COLOR, styleColor); + styleColor = commandLine.getOptionValue(CLIManager.COLOR, styleColor); if ("always".equals(styleColor) || "yes".equals(styleColor) || "force".equals(styleColor)) { MessageUtils.setColorEnabled(true); } else if ("never".equals(styleColor) || "no".equals(styleColor) || "none".equals(styleColor)) { @@ -497,8 +492,9 @@ public class MavenCli { throw new IllegalArgumentException( "Invalid color configuration value '" + styleColor + "'. Supported are 'auto', 'always', 'never'."); } else { - boolean isBatchMode = !commandLine.hasOption(FORCE_INTERACTIVE) - && (commandLine.hasOption(BATCH_MODE) || commandLine.hasOption(NON_INTERACTIVE)); + boolean isBatchMode = !commandLine.hasOption(CLIManager.FORCE_INTERACTIVE) + && (commandLine.hasOption(CLIManager.BATCH_MODE) + || commandLine.hasOption(CLIManager.NON_INTERACTIVE)); if (isBatchMode || commandLine.hasOption(CLIManager.LOG_FILE)) { MessageUtils.setColorEnabled(false); } @@ -520,7 +516,7 @@ public class MavenCli { // LOG STREAMS if (commandLine.hasOption(CLIManager.LOG_FILE)) { File logFile = new File(commandLine.getOptionValue(CLIManager.LOG_FILE)); - logFile = resolveFile(logFile, cliRequest.workingDirectory); + logFile = ResolveFile.resolveFile(logFile, cliRequest.workingDirectory); // redirect stdout and stderr to file try { @@ -926,7 +922,7 @@ public class MavenCli { if (extClassPath != null && !extClassPath.isEmpty()) { for (String jar : extClassPath.split(File.pathSeparator)) { - File file = resolveFile(new File(jar), cliRequest.workingDirectory); + File file = ResolveFile.resolveFile(new File(jar), cliRequest.workingDirectory); slf4jLogger.debug(" included '{}'", file); @@ -1200,7 +1196,7 @@ public class MavenCli { if (cliRequest.commandLine.hasOption(CLIManager.ALTERNATE_USER_TOOLCHAINS)) { userToolchainsFile = new File(cliRequest.commandLine.getOptionValue(CLIManager.ALTERNATE_USER_TOOLCHAINS)); - userToolchainsFile = resolveFile(userToolchainsFile, cliRequest.workingDirectory); + userToolchainsFile = ResolveFile.resolveFile(userToolchainsFile, cliRequest.workingDirectory); if (!userToolchainsFile.isFile()) { throw new FileNotFoundException( @@ -1218,7 +1214,8 @@ public class MavenCli { if (cliRequest.commandLine.hasOption(CLIManager.ALTERNATE_INSTALLATION_TOOLCHAINS)) { installationToolchainsFile = new File(cliRequest.commandLine.getOptionValue(CLIManager.ALTERNATE_INSTALLATION_TOOLCHAINS)); - installationToolchainsFile = resolveFile(installationToolchainsFile, cliRequest.workingDirectory); + installationToolchainsFile = + ResolveFile.resolveFile(installationToolchainsFile, cliRequest.workingDirectory); if (!installationToolchainsFile.isFile()) { throw new FileNotFoundException( @@ -1227,7 +1224,8 @@ public class MavenCli { } else if (cliRequest.commandLine.hasOption(CLIManager.ALTERNATE_GLOBAL_TOOLCHAINS)) { installationToolchainsFile = new File(cliRequest.commandLine.getOptionValue(CLIManager.ALTERNATE_GLOBAL_TOOLCHAINS)); - installationToolchainsFile = resolveFile(installationToolchainsFile, cliRequest.workingDirectory); + installationToolchainsFile = + ResolveFile.resolveFile(installationToolchainsFile, cliRequest.workingDirectory); if (!installationToolchainsFile.isFile()) { throw new FileNotFoundException( @@ -1238,7 +1236,8 @@ public class MavenCli { cliRequest.getUserProperties().getProperty(Constants.MAVEN_INSTALLATION_TOOLCHAINS); if (installationToolchainsFileStr != null) { installationToolchainsFile = new File(installationToolchainsFileStr); - installationToolchainsFile = resolveFile(installationToolchainsFile, cliRequest.workingDirectory); + installationToolchainsFile = + ResolveFile.resolveFile(installationToolchainsFile, cliRequest.workingDirectory); } } @@ -1377,11 +1376,11 @@ public class MavenCli { private void disableInteractiveModeIfNeeded(final CliRequest cliRequest, final MavenExecutionRequest request) { CommandLine commandLine = cliRequest.getCommandLine(); - if (commandLine.hasOption(FORCE_INTERACTIVE)) { + if (commandLine.hasOption(CLIManager.FORCE_INTERACTIVE)) { return; } - if (commandLine.hasOption(BATCH_MODE) || commandLine.hasOption(NON_INTERACTIVE)) { + if (commandLine.hasOption(CLIManager.BATCH_MODE) || commandLine.hasOption(CLIManager.NON_INTERACTIVE)) { request.setInteractiveMode(false); } else { boolean runningOnCI = isRunningOnCI(cliRequest.getSystemProperties()); @@ -1422,7 +1421,7 @@ public class MavenCli { File current = baseDirectory; if (alternatePomFile != null) { - current = resolveFile(new File(alternatePomFile), workingDirectory); + current = ResolveFile.resolveFile(new File(alternatePomFile), workingDirectory); } if (modelProcessor != null) { @@ -1524,7 +1523,7 @@ public class MavenCli { final CommandLine commandLine, final MavenExecutionRequest request) { boolean runningOnCI = isRunningOnCI(request.getSystemProperties()); - boolean quietCI = runningOnCI && !commandLine.hasOption(FORCE_INTERACTIVE); + boolean quietCI = runningOnCI && !commandLine.hasOption(CLIManager.FORCE_INTERACTIVE); if (quiet || commandLine.hasOption(CLIManager.NO_TRANSFER_PROGRESS) || quietCI) { return new QuietMavenTransferListener(); diff --git a/compat/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerDocumentationTest.java b/compat/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerDocumentationTest.java index 50dfa3823e..1a531085cf 100644 --- a/compat/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerDocumentationTest.java +++ b/compat/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerDocumentationTest.java @@ -37,6 +37,7 @@ import static java.util.Objects.nonNull; * Pseudo test to generate documentation fragment about supported CLI options. TODO such documentation generation code * should not be necessary as unit test but should be run during site generation (Velocity? Doxia macro?) */ +@Deprecated class CLIManagerDocumentationTest { private static final String LS = System.lineSeparator(); diff --git a/compat/maven-embedder/src/test/java/org/apache/maven/cli/CLIReportingUtilsTest.java b/compat/maven-embedder/src/test/java/org/apache/maven/cli/CLIReportingUtilsTest.java index f9c0aac04c..3f5e70b7f5 100644 --- a/compat/maven-embedder/src/test/java/org/apache/maven/cli/CLIReportingUtilsTest.java +++ b/compat/maven-embedder/src/test/java/org/apache/maven/cli/CLIReportingUtilsTest.java @@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +@Deprecated class CLIReportingUtilsTest { @Test diff --git a/compat/maven-embedder/src/test/java/org/apache/maven/cli/CleanArgumentTest.java b/compat/maven-embedder/src/test/java/org/apache/maven/cli/CleanArgumentTest.java index 9dfea2ec3b..396cab4bb8 100644 --- a/compat/maven-embedder/src/test/java/org/apache/maven/cli/CleanArgumentTest.java +++ b/compat/maven-embedder/src/test/java/org/apache/maven/cli/CleanArgumentTest.java @@ -24,6 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; /** */ +@Deprecated class CleanArgumentTest { @Test diff --git a/compat/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java b/compat/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java index 69c5feb8d9..0e57e4b381 100644 --- a/compat/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java +++ b/compat/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java @@ -84,6 +84,7 @@ import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; +@Deprecated class MavenCliTest { private MavenCli cli; diff --git a/compat/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java b/compat/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java index 806eb8842e..9d9a8f19c0 100644 --- a/compat/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java +++ b/compat/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java @@ -40,6 +40,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.when; +@Deprecated class ExecutionEventLoggerTest { private Logger logger; diff --git a/compat/maven-embedder/src/test/java/org/apache/maven/cli/props/MavenPropertiesLoaderTest.java b/compat/maven-embedder/src/test/java/org/apache/maven/cli/props/MavenPropertiesLoaderTest.java index 991e597cad..c54dd22d9f 100644 --- a/compat/maven-embedder/src/test/java/org/apache/maven/cli/props/MavenPropertiesLoaderTest.java +++ b/compat/maven-embedder/src/test/java/org/apache/maven/cli/props/MavenPropertiesLoaderTest.java @@ -32,6 +32,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; +@Deprecated class MavenPropertiesLoaderTest { @Test diff --git a/compat/maven-embedder/src/test/java/org/apache/maven/cli/props/MavenPropertiesTest.java b/compat/maven-embedder/src/test/java/org/apache/maven/cli/props/MavenPropertiesTest.java index f30a65226f..6ae68b4dce 100644 --- a/compat/maven-embedder/src/test/java/org/apache/maven/cli/props/MavenPropertiesTest.java +++ b/compat/maven-embedder/src/test/java/org/apache/maven/cli/props/MavenPropertiesTest.java @@ -38,6 +38,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; /** * Unit tests on <code>MavenProperties</code>. */ +@Deprecated public class MavenPropertiesTest { private static final String LINE_SEPARATOR = System.getProperty("line.separator"); diff --git a/compat/maven-embedder/src/test/java/org/apache/maven/cli/transfer/ConsoleMavenTransferListenerTest.java b/compat/maven-embedder/src/test/java/org/apache/maven/cli/transfer/ConsoleMavenTransferListenerTest.java index 93169b2ca7..8a7f4426f5 100644 --- a/compat/maven-embedder/src/test/java/org/apache/maven/cli/transfer/ConsoleMavenTransferListenerTest.java +++ b/compat/maven-embedder/src/test/java/org/apache/maven/cli/transfer/ConsoleMavenTransferListenerTest.java @@ -36,6 +36,7 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertTrue; +@Deprecated class ConsoleMavenTransferListenerTest { private CountDownLatch startLatch; diff --git a/compat/maven-embedder/src/test/java/org/apache/maven/cli/transfer/FileSizeFormatTest.java b/compat/maven-embedder/src/test/java/org/apache/maven/cli/transfer/FileSizeFormatTest.java index 0407ce4fd6..18412aee18 100644 --- a/compat/maven-embedder/src/test/java/org/apache/maven/cli/transfer/FileSizeFormatTest.java +++ b/compat/maven-embedder/src/test/java/org/apache/maven/cli/transfer/FileSizeFormatTest.java @@ -24,6 +24,7 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +@Deprecated class FileSizeFormatTest { @Test diff --git a/compat/maven-embedder/src/test/java/org/apache/maven/cli/transfer/SimplexTransferListenerTest.java b/compat/maven-embedder/src/test/java/org/apache/maven/cli/transfer/SimplexTransferListenerTest.java index 4e285b9930..4484be95e9 100644 --- a/compat/maven-embedder/src/test/java/org/apache/maven/cli/transfer/SimplexTransferListenerTest.java +++ b/compat/maven-embedder/src/test/java/org/apache/maven/cli/transfer/SimplexTransferListenerTest.java @@ -31,6 +31,7 @@ import org.mockito.Mockito; import static org.junit.jupiter.api.Assertions.assertThrows; +@Deprecated class SimplexTransferListenerTest { @Test void cancellation() throws InterruptedException {