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
The following commit(s) were added to refs/heads/master by this push:
new 704461f279 Upgrade to spotless 3.0.0 and palantir 2.80.0 (#11275)
704461f279 is described below
commit 704461f279ee0c44291acfa3982ca4bac451a639
Author: Guillaume Nodet <[email protected]>
AuthorDate: Thu Oct 16 08:12:36 2025 +0200
Upgrade to spotless 3.0.0 and palantir 2.80.0 (#11275)
---
.../main/java/org/apache/maven/api/cli/Logger.java | 5 ++-
.../apache/maven/api/services/RequestTrace.java | 5 ++-
.../main/java/org/apache/maven/cli/MavenCli.java | 7 +--
.../cli/transfer/TransferResourceIdentifier.java | 6 ++-
.../maven/cli/props/MavenPropertiesTest.java | 3 +-
.../src/main/java/org/apache/maven/utils/Os.java | 7 +--
.../internal/ArtifactDescriptorUtils.java | 4 +-
.../UserPropertiesArtifactRelocationSource.java | 5 ++-
.../apache/maven/cling/invoker/LookupInvoker.java | 7 +--
.../maven/cling/invoker/mvnsh/ShellInvoker.java | 3 +-
.../cling/transfer/TransferResourceIdentifier.java | 6 ++-
.../maven/cling/invoker/mvn/MavenInvokerTest.java | 12 ++---
.../cling/invoker/mvn/MavenInvokerTestSupport.java | 6 +--
.../mvnup/goals/CompatibilityFixStrategyTest.java | 9 ++--
.../cling/invoker/mvnup/goals/GAVUtilsTest.java | 27 ++++--------
.../invoker/mvnup/goals/InferenceStrategyTest.java | 51 ++++++++--------------
.../cling/invoker/mvnup/goals/JDomUtilsTest.java | 30 +++++--------
.../mvnup/goals/ModelUpgradeStrategyTest.java | 21 +++------
.../invoker/mvnup/goals/ModelVersionUtilsTest.java | 24 ++++------
.../mvnup/goals/PluginUpgradeStrategyTest.java | 33 +++++---------
.../maven/cling/invoker/mvnup/goals/TestUtils.java | 12 ++---
.../internal/concurrent/BuildPlanExecutor.java | 3 +-
.../maven/project/DefaultProjectBuilder.java | 5 ++-
.../maven/project/RepositoryLeakageTest.java | 12 ++---
.../cling/executor/MavenExecutorTestSupport.java | 6 +--
.../java/org/apache/maven/impl/cache/Cache.java | 15 ++++---
.../maven/impl/model/DefaultModelValidator.java | 6 +--
.../impl/resolver/ArtifactDescriptorUtils.java | 4 +-
.../UserPropertiesArtifactRelocationSource.java | 5 ++-
.../main/java/org/apache/maven/impl/util/Os.java | 7 +--
.../maven/impl/DefaultModelXmlFactoryTest.java | 21 +++------
.../maven/impl/DefaultPluginXmlFactoryTest.java | 6 +--
.../maven/impl/XmlFactoryTransformerTest.java | 12 ++---
.../maven/impl/cache/CacheConfigurationTest.java | 7 +--
.../maven/impl/model/InterningTransformerTest.java | 6 +--
.../maven/impl/model/ParentCycleDetectionTest.java | 28 +++---------
.../apache/maven/internal/xml/XmlNodeImplTest.java | 12 ++---
pom.xml | 7 +++
38 files changed, 177 insertions(+), 268 deletions(-)
diff --git
a/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/Logger.java
b/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/Logger.java
index cd9aaff994..7d5d2aebb5 100644
--- a/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/Logger.java
+++ b/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/Logger.java
@@ -148,7 +148,10 @@ default void error(@Nonnull String message, @Nullable
Throwable error) {
* @param message The logging message, never {@code null}.
* @param error The error, if applicable.
*/
- record Entry(@Nonnull Level level, @Nonnull String message, @Nullable
Throwable error) {}
+ record Entry(
+ @Nonnull Level level,
+ @Nonnull String message,
+ @Nullable Throwable error) {}
/**
* If this is an accumulating log, it will "drain" this instance. It
returns the accumulated log entries, and
diff --git
a/api/maven-api-core/src/main/java/org/apache/maven/api/services/RequestTrace.java
b/api/maven-api-core/src/main/java/org/apache/maven/api/services/RequestTrace.java
index 6dafc3aeaf..ac67cb6450 100644
---
a/api/maven-api-core/src/main/java/org/apache/maven/api/services/RequestTrace.java
+++
b/api/maven-api-core/src/main/java/org/apache/maven/api/services/RequestTrace.java
@@ -50,7 +50,10 @@
* object being processed or any application-specific state
information. May be null if no
* additional data is needed.
*/
-public record RequestTrace(@Nullable String context, @Nullable RequestTrace
parent, @Nullable Object data) {
+public record RequestTrace(
+ @Nullable String context,
+ @Nullable RequestTrace parent,
+ @Nullable Object data) {
public static final String CONTEXT_PLUGIN = "plugin";
public static final String CONTEXT_PROJECT = "project";
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 d42591953d..fec07d6979 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
@@ -544,9 +544,10 @@ void logging(CliRequest cliRequest) throws ExitException {
switch (logLevelThreshold.toLowerCase(Locale.ENGLISH))
{
case "warn", "warning" ->
LogLevelRecorder.Level.WARN;
case "error" -> LogLevelRecorder.Level.ERROR;
- default -> throw new IllegalArgumentException(
- logLevelThreshold
- + " is not a valid log severity
threshold. Valid severities are WARN/WARNING and ERROR.");
+ default ->
+ throw new IllegalArgumentException(
+ logLevelThreshold
+ + " is not a valid log
severity threshold. Valid severities are WARN/WARNING and ERROR.");
};
recorder.setMaxLevelAllowed(level);
slf4jLogger.info("Enabled to break the build on log level
{}.", logLevelThreshold);
diff --git
a/compat/maven-embedder/src/main/java/org/apache/maven/cli/transfer/TransferResourceIdentifier.java
b/compat/maven-embedder/src/main/java/org/apache/maven/cli/transfer/TransferResourceIdentifier.java
index 8789b9b1e1..c259ae14d4 100644
---
a/compat/maven-embedder/src/main/java/org/apache/maven/cli/transfer/TransferResourceIdentifier.java
+++
b/compat/maven-embedder/src/main/java/org/apache/maven/cli/transfer/TransferResourceIdentifier.java
@@ -29,7 +29,11 @@
* making it not very suitable for usage in collections.
*/
@Deprecated
-record TransferResourceIdentifier(String repositoryId, String repositoryUrl,
String resourceName, @Nullable File file) {
+record TransferResourceIdentifier(
+ String repositoryId,
+ String repositoryUrl,
+ String resourceName,
+ @Nullable File file) {
TransferResourceIdentifier(TransferResource resource) {
this(resource.getRepositoryId(), resource.getRepositoryUrl(),
resource.getResourceName(), resource.getFile());
}
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 07aa1e8ba6..72628a365f 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
@@ -51,8 +51,7 @@ public class MavenPropertiesTest {
private MavenProperties properties;
- static final String TEST_PROPERTIES =
- """
+ static final String TEST_PROPERTIES = """
#
# test.properties
# Used in the PropertiesTest
diff --git
a/compat/maven-model-builder/src/main/java/org/apache/maven/utils/Os.java
b/compat/maven-model-builder/src/main/java/org/apache/maven/utils/Os.java
index ef189d6a51..b4d29435b9 100644
--- a/compat/maven-model-builder/src/main/java/org/apache/maven/utils/Os.java
+++ b/compat/maven-model-builder/src/main/java/org/apache/maven/utils/Os.java
@@ -188,9 +188,10 @@ public static boolean isFamily(String family, String
actualOsName) {
case FAMILY_DOS -> File.pathSeparatorChar == ';' &&
!isFamily(FAMILY_NETWARE, actualOsName) && !isWindows;
case FAMILY_MAC -> actualOsName.contains(FAMILY_MAC) ||
actualOsName.contains(DARWIN);
case FAMILY_TANDEM -> actualOsName.contains("nonstop_kernel");
- case FAMILY_UNIX -> File.pathSeparatorChar == ':'
- && !isFamily(FAMILY_OPENVMS, actualOsName)
- && (!isFamily(FAMILY_MAC, actualOsName) ||
actualOsName.endsWith("x"));
+ case FAMILY_UNIX ->
+ File.pathSeparatorChar == ':'
+ && !isFamily(FAMILY_OPENVMS, actualOsName)
+ && (!isFamily(FAMILY_MAC, actualOsName) ||
actualOsName.endsWith("x"));
case FAMILY_ZOS -> actualOsName.contains(FAMILY_ZOS) ||
actualOsName.contains(FAMILY_OS390);
case FAMILY_OS400 -> actualOsName.contains(FAMILY_OS400);
case FAMILY_OPENVMS -> actualOsName.contains(FAMILY_OPENVMS);
diff --git
a/compat/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java
b/compat/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java
index 821db5de14..7771fb7646 100644
---
a/compat/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java
+++
b/compat/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java
@@ -86,8 +86,8 @@ public static String toRepositoryChecksumPolicy(final String
artifactRepositoryP
case RepositoryPolicy.CHECKSUM_POLICY_FAIL ->
RepositoryPolicy.CHECKSUM_POLICY_FAIL;
case RepositoryPolicy.CHECKSUM_POLICY_IGNORE ->
RepositoryPolicy.CHECKSUM_POLICY_IGNORE;
case RepositoryPolicy.CHECKSUM_POLICY_WARN ->
RepositoryPolicy.CHECKSUM_POLICY_WARN;
- default -> throw new IllegalArgumentException(
- "unknown repository checksum policy: " +
artifactRepositoryPolicy);
+ default ->
+ throw new IllegalArgumentException("unknown repository
checksum policy: " + artifactRepositoryPolicy);
};
}
}
diff --git
a/compat/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/relocation/UserPropertiesArtifactRelocationSource.java
b/compat/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/relocation/UserPropertiesArtifactRelocationSource.java
index b469672b79..ea0004223a 100644
---
a/compat/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/relocation/UserPropertiesArtifactRelocationSource.java
+++
b/compat/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/relocation/UserPropertiesArtifactRelocationSource.java
@@ -202,8 +202,9 @@ private static Artifact parseArtifact(String coords) {
case 3 -> new DefaultArtifact(parts[0], parts[1], "*", "*",
parts[2]);
case 4 -> new DefaultArtifact(parts[0], parts[1], "*", parts[2],
parts[3]);
case 5 -> new DefaultArtifact(parts[0], parts[1], parts[2],
parts[3], parts[4]);
- default -> throw new IllegalArgumentException("Bad artifact
coordinates " + coords
- + ", expected format is
<groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>");
+ default ->
+ throw new IllegalArgumentException("Bad artifact coordinates "
+ coords
+ + ", expected format is
<groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>");
};
return s;
}
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 9844cfb8d4..0d5e5caa64 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
@@ -430,9 +430,10 @@ protected void activateLogging(C context) throws Exception
{
switch (logLevelThreshold.toLowerCase(Locale.ENGLISH))
{
case "warn", "warning" ->
LogLevelRecorder.Level.WARN;
case "error" -> LogLevelRecorder.Level.ERROR;
- default -> throw new IllegalArgumentException(
- logLevelThreshold
- + " is not a valid log severity
threshold. Valid severities are WARN/WARNING and ERROR.");
+ default ->
+ throw new IllegalArgumentException(
+ logLevelThreshold
+ + " is not a valid log
severity threshold. Valid severities are WARN/WARNING and ERROR.");
};
recorder.setMaxLevelAllowed(level);
context.logger.info("Enabled to break the build on log level "
+ logLevelThreshold + ".");
diff --git
a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnsh/ShellInvoker.java
b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnsh/ShellInvoker.java
index 01c22ed1eb..6dbc69d654 100644
---
a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnsh/ShellInvoker.java
+++
b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnsh/ShellInvoker.java
@@ -89,8 +89,7 @@ protected int execute(LookupContext context) throws Exception
{
DefaultParser parser = new DefaultParser();
parser.setRegexCommand("[:]{0,1}[a-zA-Z!]{1,}\\S*"); // change default
regex to support shell commands
- String banner =
- """
+ String banner = """
░▒▓██████████████▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓███████▓▒░
░▒▓███████▓▒░░▒▓█▓▒░░▒▓█▓▒░\s
░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░
░▒▓█▓▒░░▒▓█▓▒░\s
diff --git
a/impl/maven-cli/src/main/java/org/apache/maven/cling/transfer/TransferResourceIdentifier.java
b/impl/maven-cli/src/main/java/org/apache/maven/cling/transfer/TransferResourceIdentifier.java
index 04af5e51a7..1efb6ba785 100644
---
a/impl/maven-cli/src/main/java/org/apache/maven/cling/transfer/TransferResourceIdentifier.java
+++
b/impl/maven-cli/src/main/java/org/apache/maven/cling/transfer/TransferResourceIdentifier.java
@@ -28,7 +28,11 @@
* The {@link TransferResource} is not immutable and does not implement {@code
Objects#equals} and {@code Objects#hashCode} methods,
* making it not very suitable for usage in collections.
*/
-record TransferResourceIdentifier(String repositoryId, String repositoryUrl,
String resourceName, @Nullable Path file) {
+record TransferResourceIdentifier(
+ String repositoryId,
+ String repositoryUrl,
+ String resourceName,
+ @Nullable Path file) {
TransferResourceIdentifier(TransferResource resource) {
this(resource.getRepositoryId(), resource.getRepositoryUrl(),
resource.getResourceName(), resource.getPath());
}
diff --git
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvn/MavenInvokerTest.java
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvn/MavenInvokerTest.java
index 2a1d8ab343..539cf8331d 100644
---
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvn/MavenInvokerTest.java
+++
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvn/MavenInvokerTest.java
@@ -74,8 +74,7 @@ void conflictingExtensionsFromSameSource(
@TempDir(cleanup = CleanupMode.ON_SUCCESS) Path cwd,
@TempDir(cleanup = CleanupMode.ON_SUCCESS) Path userHome)
throws Exception {
- String projectExtensionsXml =
- """
+ String projectExtensionsXml = """
<?xml version="1.0" encoding="UTF-8"?>
<extensions>
<extension>
@@ -95,8 +94,7 @@ void conflictingExtensionsFromSameSource(
Path projectExtensions = dotMvn.resolve("extensions.xml");
Files.writeString(projectExtensions, projectExtensionsXml);
- String userExtensionsXml =
- """
+ String userExtensionsXml = """
<?xml version="1.0" encoding="UTF-8"?>
<extensions>
<extension>
@@ -122,8 +120,7 @@ void conflictingExtensionsFromDifferentSource(
@TempDir(cleanup = CleanupMode.ON_SUCCESS) Path cwd,
@TempDir(cleanup = CleanupMode.ON_SUCCESS) Path userHome)
throws Exception {
- String extensionsXml =
- """
+ String extensionsXml = """
<?xml version="1.0" encoding="UTF-8"?>
<extensions>
<extension>
@@ -163,8 +160,7 @@ void conflictingSettings(
@TempDir(cleanup = CleanupMode.ON_SUCCESS) Path cwd,
@TempDir(cleanup = CleanupMode.ON_SUCCESS) Path userHome)
throws Exception {
- String settingsXml =
- """
+ String settingsXml = """
<?xml version="1.0"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
diff --git
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvn/MavenInvokerTestSupport.java
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvn/MavenInvokerTestSupport.java
index 9778cda9c4..52cde3a2b6 100644
---
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvn/MavenInvokerTestSupport.java
+++
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvn/MavenInvokerTestSupport.java
@@ -44,8 +44,7 @@ public abstract class MavenInvokerTestSupport {
Path.of("target/dependency/org/jline/nativ").toAbsolutePath().toString());
}
- public static final String POM_STRING =
- """
+ public static final String POM_STRING = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/maven-v4_0_0.xsd">
@@ -79,8 +78,7 @@ public abstract class MavenInvokerTestSupport {
</project>
""";
- public static final String APP_JAVA_STRING =
- """
+ public static final String APP_JAVA_STRING = """
package org.apache.maven.samples.sample;
public class App {
diff --git
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/CompatibilityFixStrategyTest.java
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/CompatibilityFixStrategyTest.java
index 91e12498c2..0a26906012 100644
---
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/CompatibilityFixStrategyTest.java
+++
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/CompatibilityFixStrategyTest.java
@@ -144,8 +144,7 @@ class DuplicateDependencyFixesTests {
@Test
@DisplayName("should remove duplicate dependencies in
dependencyManagement")
void shouldRemoveDuplicateDependenciesInDependencyManagement() throws
Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -191,8 +190,7 @@ void
shouldRemoveDuplicateDependenciesInDependencyManagement() throws Exception
@Test
@DisplayName("should remove duplicate dependencies in regular
dependencies")
void shouldRemoveDuplicateDependenciesInRegularDependencies() throws
Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -242,8 +240,7 @@ class DuplicatePluginFixesTests {
@Test
@DisplayName("should remove duplicate plugins in pluginManagement")
void shouldRemoveDuplicatePluginsInPluginManagement() throws Exception
{
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
diff --git
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/GAVUtilsTest.java
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/GAVUtilsTest.java
index 5585616ec4..e74aff47ee 100644
---
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/GAVUtilsTest.java
+++
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/GAVUtilsTest.java
@@ -87,8 +87,7 @@ void shouldExtractGAVFromCompletePOM() throws Exception {
@Test
@DisplayName("should extract GAV with parent inheritance")
void shouldExtractGAVWithParentInheritance() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -116,8 +115,7 @@ void shouldExtractGAVWithParentInheritance() throws
Exception {
@Test
@DisplayName("should handle partial parent inheritance")
void shouldHandlePartialParentInheritance() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -182,8 +180,7 @@ class GAVComputationTests {
@Test
@DisplayName("should compute GAVs from multiple POMs")
void shouldComputeGAVsFromMultiplePOMs() throws Exception {
- String parentPomXml =
- """
+ String parentPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -194,8 +191,7 @@ void shouldComputeGAVsFromMultiplePOMs() throws Exception {
</project>
""";
- String childPomXml =
- """
+ String childPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -239,8 +235,7 @@ void shouldHandleEmptyPOMMap() {
@Test
@DisplayName("should deduplicate identical GAVs")
void shouldDeduplicateIdenticalGAVs() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -268,8 +263,7 @@ void shouldDeduplicateIdenticalGAVs() throws Exception {
@Test
@DisplayName("should skip POMs with incomplete GAVs")
void shouldSkipPOMsWithIncompleteGAVs() throws Exception {
- String validPomXml =
- """
+ String validPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -279,8 +273,7 @@ void shouldSkipPOMsWithIncompleteGAVs() throws Exception {
</project>
""";
- String invalidPomXml =
- """
+ String invalidPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -330,8 +323,7 @@ void shouldHandlePOMWithWhitespaceElements() throws
Exception {
@Test
@DisplayName("should handle POM with empty elements")
void shouldHandlePOMWithEmptyElements() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -372,8 +364,7 @@ void shouldHandlePOMWithSpecialCharacters() throws
Exception {
@Test
@DisplayName("should handle deeply nested parent inheritance")
void shouldHandleDeeplyNestedParentInheritance() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
diff --git
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/InferenceStrategyTest.java
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/InferenceStrategyTest.java
index 766c30be58..f2a84de3a8 100644
---
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/InferenceStrategyTest.java
+++
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/InferenceStrategyTest.java
@@ -146,8 +146,7 @@ void shouldRemoveDependencyVersionForProjectArtifact()
throws Exception {
.artifactId("module-a")
.build();
- String moduleBPomXml =
- """
+ String moduleBPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0">
<parent>
@@ -199,8 +198,7 @@ void shouldRemoveDependencyVersionForProjectArtifact()
throws Exception {
@Test
@DisplayName("should keep dependency version for external artifact")
void shouldKeepDependencyVersionForExternalArtifact() throws Exception
{
- String modulePomXml =
- """
+ String modulePomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0">
<groupId>com.example</groupId>
@@ -280,8 +278,7 @@ void shouldKeepDependencyVersionWhenVersionMismatch()
throws Exception {
@Test
@DisplayName("should handle plugin dependencies")
void shouldHandlePluginDependencies() throws Exception {
- String moduleAPomXml =
- """
+ String moduleAPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0">
<groupId>com.example</groupId>
@@ -290,8 +287,7 @@ void shouldHandlePluginDependencies() throws Exception {
</project>
""";
- String moduleBPomXml =
- """
+ String moduleBPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0">
<groupId>com.example</groupId>
@@ -347,8 +343,7 @@ class ParentInferenceTests {
@Test
@DisplayName("should remove parent groupId when child doesn't have
explicit groupId")
void shouldRemoveParentGroupIdWhenChildDoesntHaveExplicitGroupId()
throws Exception {
- String parentPomXml =
- """
+ String parentPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0">
<modelVersion>4.1.0</modelVersion>
@@ -358,8 +353,7 @@ void
shouldRemoveParentGroupIdWhenChildDoesntHaveExplicitGroupId() throws Except
</project>
""";
- String childPomXml =
- """
+ String childPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0">
<modelVersion>4.1.0</modelVersion>
@@ -404,8 +398,7 @@ void
shouldRemoveParentGroupIdWhenChildDoesntHaveExplicitGroupId() throws Except
@Test
@DisplayName("should keep parent groupId when child has explicit
groupId")
void shouldKeepParentGroupIdWhenChildHasExplicitGroupId() throws
Exception {
- String parentPomXml =
- """
+ String parentPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0">
<modelVersion>4.1.0</modelVersion>
@@ -415,8 +408,7 @@ void shouldKeepParentGroupIdWhenChildHasExplicitGroupId()
throws Exception {
</project>
""";
- String childPomXml =
- """
+ String childPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0">
<modelVersion>4.1.0</modelVersion>
@@ -456,8 +448,7 @@ void shouldKeepParentGroupIdWhenChildHasExplicitGroupId()
throws Exception {
@Test
@DisplayName("should not trim parent elements when parent is external")
void shouldNotTrimParentElementsWhenParentIsExternal() throws
Exception {
- String childPomXml =
- """
+ String childPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0">
<modelVersion>4.1.0</modelVersion>
@@ -497,8 +488,7 @@ void shouldNotTrimParentElementsWhenParentIsExternal()
throws Exception {
@DisplayName("should trim parent elements when parent is in reactor")
void shouldTrimParentElementsWhenParentIsInReactor() throws Exception {
// Create parent POM
- String parentPomXml =
- """
+ String parentPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0">
<modelVersion>4.1.0</modelVersion>
@@ -510,8 +500,7 @@ void shouldTrimParentElementsWhenParentIsInReactor() throws
Exception {
""";
// Create child POM that references the parent
- String childPomXml =
- """
+ String childPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0">
<modelVersion>4.1.0</modelVersion>
@@ -557,8 +546,7 @@ class Maven400LimitedInferenceTests {
@Test
@DisplayName("should remove child groupId and version when they match
parent in 4.0.0")
void shouldRemoveChildGroupIdAndVersionWhenTheyMatchParentIn400()
throws Exception {
- String parentPomXml =
- """
+ String parentPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -569,8 +557,7 @@ void
shouldRemoveChildGroupIdAndVersionWhenTheyMatchParentIn400() throws Excepti
</project>
""";
- String childPomXml =
- """
+ String childPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -622,8 +609,7 @@ void
shouldRemoveChildGroupIdAndVersionWhenTheyMatchParentIn400() throws Excepti
@Test
@DisplayName("should keep child groupId when it differs from parent in
4.0.0")
void shouldKeepChildGroupIdWhenItDiffersFromParentIn400() throws
Exception {
- String parentPomXml =
- """
+ String parentPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -634,8 +620,7 @@ void shouldKeepChildGroupIdWhenItDiffersFromParentIn400()
throws Exception {
</project>
""";
- String childPomXml =
- """
+ String childPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -678,8 +663,7 @@ void shouldKeepChildGroupIdWhenItDiffersFromParentIn400()
throws Exception {
@Test
@DisplayName("should handle partial inheritance in 4.0.0")
void shouldHandlePartialInheritanceIn400() throws Exception {
- String parentPomXml =
- """
+ String parentPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -690,8 +674,7 @@ void shouldHandlePartialInheritanceIn400() throws Exception
{
</project>
""";
- String childPomXml =
- """
+ String childPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
diff --git
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/JDomUtilsTest.java
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/JDomUtilsTest.java
index 1ab9a9d730..412c9f63ed 100644
---
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/JDomUtilsTest.java
+++
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/JDomUtilsTest.java
@@ -47,8 +47,7 @@ void setUp() {
@Test
void testDetectTwoSpaceIndentation() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -76,8 +75,7 @@ void testDetectTwoSpaceIndentation() throws Exception {
@Test
void testDetectFourSpaceIndentation() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -105,8 +103,7 @@ void testDetectFourSpaceIndentation() throws Exception {
@Test
void testDetectTabIndentation() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
\t<modelVersion>4.0.0</modelVersion>
@@ -135,8 +132,7 @@ void testDetectTabIndentation() throws Exception {
@Test
void testDetectIndentationWithMixedContent() throws Exception {
// POM with mostly 4-space indentation but some 2-space (should prefer
4-space)
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -173,8 +169,7 @@ void testDetectIndentationWithMixedContent() throws
Exception {
@Test
void testDetectIndentationFromBuildElement() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -204,8 +199,7 @@ void testDetectIndentationFromBuildElement() throws
Exception {
@Test
void testDetectIndentationFallbackToDefault() throws Exception {
// Minimal POM with no clear indentation pattern
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"><modelVersion>4.0.0</modelVersion><groupId>test</groupId><artifactId>test</artifactId><version>1.0.0</version></project>
""";
@@ -219,8 +213,7 @@ void testDetectIndentationFallbackToDefault() throws
Exception {
@Test
void testDetectIndentationConsistency() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -258,8 +251,7 @@ void testDetectIndentationConsistency() throws Exception {
@Test
void testAddElementWithCorrectIndentation() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -299,8 +291,7 @@ void testAddElementWithCorrectIndentation() throws
Exception {
@Test
void testRealWorldScenarioWithPluginManagementAddition() throws Exception {
// Real-world POM with 4-space indentation
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -386,8 +377,7 @@ void testRealWorldScenarioWithPluginManagementAddition()
throws Exception {
@Test
void testProperClosingTagFormattingWithPluginManagement() throws Exception
{
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
diff --git
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/ModelUpgradeStrategyTest.java
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/ModelUpgradeStrategyTest.java
index ab20e4c132..83e5c80a06 100644
---
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/ModelUpgradeStrategyTest.java
+++
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/ModelUpgradeStrategyTest.java
@@ -206,8 +206,7 @@ class NamespaceUpdateTests {
@Test
@DisplayName("should update namespace recursively")
void shouldUpdateNamespaceRecursively() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -257,8 +256,7 @@ void shouldUpdateNamespaceRecursively() throws Exception {
@Test
@DisplayName("should convert modules to subprojects in 4.1.0")
void shouldConvertModulesToSubprojectsIn410() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -354,8 +352,7 @@ void shouldUpgradeDeprecatedPhasesIn410() throws Exception {
}
private Document createDocumentWithDeprecatedPhases() throws Exception
{
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -633,8 +630,7 @@ private void verifyProfilePhases(Document document) {
@Test
@DisplayName("should not upgrade phases when upgrading to 4.0.0")
void shouldNotUpgradePhasesWhenUpgradingTo400() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -691,8 +687,7 @@ void shouldNotUpgradePhasesWhenUpgradingTo400() throws
Exception {
@Test
@DisplayName("should preserve non-deprecated phases")
void shouldPreserveNonDeprecatedPhases() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -792,8 +787,7 @@ class DowngradeHandlingTests {
@Test
@DisplayName("should fail with error when attempting downgrade from
4.1.0 to 4.0.0")
void shouldFailWhenAttemptingDowngrade() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0">
<modelVersion>4.1.0</modelVersion>
@@ -819,8 +813,7 @@ void shouldFailWhenAttemptingDowngrade() throws Exception {
@Test
@DisplayName("should succeed when upgrading from 4.0.0 to 4.1.0")
void shouldSucceedWhenUpgrading() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
diff --git
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/ModelVersionUtilsTest.java
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/ModelVersionUtilsTest.java
index 531c52c1ab..b1c4dd599b 100644
---
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/ModelVersionUtilsTest.java
+++
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/ModelVersionUtilsTest.java
@@ -90,8 +90,7 @@ void shouldDetect410ModelVersion() throws Exception {
@Test
@DisplayName("should return default version when model version is
missing")
void shouldReturnDefaultVersionWhenModelVersionMissing() throws
Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<groupId>test</groupId>
@@ -108,8 +107,7 @@ void shouldReturnDefaultVersionWhenModelVersionMissing()
throws Exception {
@Test
@DisplayName("should detect version from namespace when model version
is missing")
void shouldDetectVersionFromNamespaceWhenModelVersionMissing() throws
Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0">
<groupId>test</groupId>
@@ -275,8 +273,7 @@ class ModelVersionUpdateTests {
@Test
@DisplayName("should update model version in document")
void shouldUpdateModelVersionInDocument() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -296,8 +293,7 @@ void shouldUpdateModelVersionInDocument() throws Exception {
@Test
@DisplayName("should add model version when missing")
void shouldAddModelVersionWhenMissing() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<groupId>test</groupId>
@@ -317,8 +313,7 @@ void shouldAddModelVersionWhenMissing() throws Exception {
@Test
@DisplayName("should remove model version from document")
void shouldRemoveModelVersionFromDocument() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -340,8 +335,7 @@ void shouldRemoveModelVersionFromDocument() throws
Exception {
@Test
@DisplayName("should handle missing model version in removal")
void shouldHandleMissingModelVersionInRemoval() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<groupId>test</groupId>
@@ -396,8 +390,7 @@ class EdgeCases {
@Test
@DisplayName("should handle missing modelVersion element")
void shouldHandleMissingModelVersion() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<groupId>com.example</groupId>
@@ -457,8 +450,7 @@ void shouldHandleCustomModelVersionValues() throws
Exception {
@Test
@DisplayName("should handle modelVersion with whitespace")
void shouldHandleModelVersionWithWhitespace() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion> 4.1.0 </modelVersion>
diff --git
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/PluginUpgradeStrategyTest.java
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/PluginUpgradeStrategyTest.java
index e84b426984..69cc3ec0fe 100644
---
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/PluginUpgradeStrategyTest.java
+++
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/PluginUpgradeStrategyTest.java
@@ -163,8 +163,7 @@ void shouldUpgradePluginVersionWhenBelowMinimum() throws
Exception {
@Test
@DisplayName("should not modify plugin when version is already
sufficient")
void shouldNotModifyPluginWhenVersionAlreadySufficient() throws
Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -196,8 +195,7 @@ void shouldNotModifyPluginWhenVersionAlreadySufficient()
throws Exception {
@Test
@DisplayName("should upgrade plugin in pluginManagement")
void shouldUpgradePluginInPluginManagement() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -241,8 +239,7 @@ void shouldUpgradePluginInPluginManagement() throws
Exception {
@Test
@DisplayName("should upgrade plugin with property version")
void shouldUpgradePluginWithPropertyVersion() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -284,8 +281,7 @@ void shouldUpgradePluginWithPropertyVersion() throws
Exception {
@Test
@DisplayName("should not upgrade when version is already higher")
void shouldNotUpgradeWhenVersionAlreadyHigher() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -325,8 +321,7 @@ void shouldNotUpgradeWhenVersionAlreadyHigher() throws
Exception {
@Test
@DisplayName("should upgrade plugin without explicit groupId")
void shouldUpgradePluginWithoutExplicitGroupId() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -368,8 +363,7 @@ void shouldUpgradePluginWithoutExplicitGroupId() throws
Exception {
@Test
@DisplayName("should not upgrade plugin without version")
void shouldNotUpgradePluginWithoutVersion() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -401,8 +395,7 @@ void shouldNotUpgradePluginWithoutVersion() throws
Exception {
@Test
@DisplayName("should not upgrade when property is not found")
void shouldNotUpgradeWhenPropertyNotFound() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -439,8 +432,7 @@ class PluginManagementTests {
@Test
@DisplayName("should add pluginManagement before existing plugins
section")
void shouldAddPluginManagementBeforeExistingPluginsSection() throws
Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -537,8 +529,7 @@ class ErrorHandlingTests {
@Test
@DisplayName("should handle malformed POM gracefully")
void shouldHandleMalformedPOMGracefully() throws Exception {
- String malformedPomXml =
- """
+ String malformedPomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -589,8 +580,7 @@ class XmlFormattingTests {
@Test
@DisplayName("should format pluginManagement with proper indentation")
void shouldFormatPluginManagementWithProperIndentation() throws
Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -640,8 +630,7 @@ void shouldFormatPluginManagementWithProperIndentation()
throws Exception {
@DisplayName("should format pluginManagement with proper indentation
when added")
void shouldFormatPluginManagementWithProperIndentationWhenAdded()
throws Exception {
// Use a POM that will trigger pluginManagement addition by having
a plugin without version
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
diff --git
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/TestUtils.java
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/TestUtils.java
index 40dff68c44..b7a5342f7b 100644
---
a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/TestUtils.java
+++
b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/TestUtils.java
@@ -194,8 +194,7 @@ public static UpgradeOptions createOptionsWithInfer(boolean
infer) {
* @return POM XML string
*/
public static String createSimplePom(String groupId, String artifactId,
String version) {
- return String.format(
- """
+ return String.format("""
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -203,8 +202,7 @@ public static String createSimplePom(String groupId, String
artifactId, String v
<artifactId>%s</artifactId>
<version>%s</version>
</project>
- """,
- groupId, artifactId, version);
+ """, groupId, artifactId, version);
}
/**
@@ -218,8 +216,7 @@ public static String createSimplePom(String groupId, String
artifactId, String v
*/
public static String createPomWithParent(
String parentGroupId, String parentArtifactId, String
parentVersion, String artifactId) {
- return String.format(
- """
+ return String.format("""
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -230,7 +227,6 @@ public static String createPomWithParent(
</parent>
<artifactId>%s</artifactId>
</project>
- """,
- parentGroupId, parentArtifactId, parentVersion, artifactId);
+ """, parentGroupId, parentArtifactId, parentVersion, artifactId);
}
}
diff --git
a/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutor.java
b/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutor.java
index 7e8428a6b1..3ed6c002d1 100644
---
a/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutor.java
+++
b/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutor.java
@@ -298,8 +298,7 @@ private void checkThreadSafety(BuildPlan buildPlan) {
.filter(execution ->
!execution.getMojoDescriptor().isV4Api())
.collect(Collectors.toSet());
if (!unsafeExecutions.isEmpty()) {
- for (String s : MultilineMessageHelper.format(
- """
+ for (String s : MultilineMessageHelper.format("""
Your build is requesting concurrent execution,
but this project contains the \
following plugin(s) that have goals not built
with Maven 4 to support concurrent \
execution. While this /may/ work fine, please
look for plugin updates and/or \
diff --git
a/impl/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
b/impl/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
index 1de9eeccc5..08f3bd53b2 100644
---
a/impl/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
+++
b/impl/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
@@ -880,8 +880,9 @@ private void initParent(MavenProject project,
ModelBuilderResult result) {
reposes.addAll(project.getRemoteArtifactRepositories());
mergedRepositories = List.copyOf(reposes);
}
- default -> throw new IllegalArgumentException(
- "Unsupported repository merging: " +
request.getRepositoryMerging());
+ default ->
+ throw new IllegalArgumentException(
+ "Unsupported repository merging: " +
request.getRepositoryMerging());
}
// Store the computed repositories for this project in
BuildSession storage
diff --git
a/impl/maven-core/src/test/java/org/apache/maven/project/RepositoryLeakageTest.java
b/impl/maven-core/src/test/java/org/apache/maven/project/RepositoryLeakageTest.java
index b5ff18f872..8052e05527 100644
---
a/impl/maven-core/src/test/java/org/apache/maven/project/RepositoryLeakageTest.java
+++
b/impl/maven-core/src/test/java/org/apache/maven/project/RepositoryLeakageTest.java
@@ -46,9 +46,7 @@ public void testRepositoryLeakageBetweenSiblings() throws
Exception {
try {
// Create parent POM
Path parentPom = tempDir.resolve("pom.xml");
- Files.writeString(
- parentPom,
- """
+ Files.writeString(parentPom, """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -71,9 +69,7 @@ public void testRepositoryLeakageBetweenSiblings() throws
Exception {
Path child1Dir = tempDir.resolve("child1");
Files.createDirectories(child1Dir);
Path child1Pom = child1Dir.resolve("pom.xml");
- Files.writeString(
- child1Pom,
- """
+ Files.writeString(child1Pom, """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -100,9 +96,7 @@ public void testRepositoryLeakageBetweenSiblings() throws
Exception {
Path child2Dir = tempDir.resolve("child2");
Files.createDirectories(child2Dir);
Path child2Pom = child2Dir.resolve("pom.xml");
- Files.writeString(
- child2Pom,
- """
+ Files.writeString(child2Pom, """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
diff --git
a/impl/maven-executor/src/test/java/org/apache/maven/cling/executor/MavenExecutorTestSupport.java
b/impl/maven-executor/src/test/java/org/apache/maven/cling/executor/MavenExecutorTestSupport.java
index ae8099cdd1..a055139f66 100644
---
a/impl/maven-executor/src/test/java/org/apache/maven/cling/executor/MavenExecutorTestSupport.java
+++
b/impl/maven-executor/src/test/java/org/apache/maven/cling/executor/MavenExecutorTestSupport.java
@@ -292,8 +292,7 @@ void defaultFs3CaptureOutputWithForcedOffColor() throws
Exception {
assertTrue(stdout.toString().contains("INFO"), "No INFO found");
}
- public static final String POM_STRING =
- """
+ public static final String POM_STRING = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/maven-v4_0_0.xsd">
@@ -327,8 +326,7 @@ void defaultFs3CaptureOutputWithForcedOffColor() throws
Exception {
</project>
""";
- public static final String APP_JAVA_STRING =
- """
+ public static final String APP_JAVA_STRING = """
package org.apache.maven.samples.sample;
public class App {
diff --git
a/impl/maven-impl/src/main/java/org/apache/maven/impl/cache/Cache.java
b/impl/maven-impl/src/main/java/org/apache/maven/impl/cache/Cache.java
index 440a0a860e..4838b36321 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/cache/Cache.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/cache/Cache.java
@@ -520,8 +520,9 @@ private ComputeReference<V>
getComputingReference(ReferenceType referenceType) {
case SOFT -> SoftComputeReference.computing(valueQueue);
case WEAK -> WeakComputeReference.computing(valueQueue);
case HARD -> HardComputeReference.computing(valueQueue);
- case NONE -> throw new IllegalArgumentException(
- "NONE reference type should be handled before calling
this method");
+ case NONE ->
+ throw new IllegalArgumentException(
+ "NONE reference type should be handled before
calling this method");
};
}
@@ -535,8 +536,9 @@ private ComputeReference<V> getValueReference(V value,
ReferenceType referenceTy
case SOFT -> new SoftComputeReference<>(value, valueQueue);
case WEAK -> new WeakComputeReference<>(value, valueQueue);
case HARD -> new HardComputeReference<>(value, valueQueue);
- case NONE -> throw new IllegalArgumentException(
- "NONE reference type should be handled before calling
this method");
+ case NONE ->
+ throw new IllegalArgumentException(
+ "NONE reference type should be handled before
calling this method");
};
}
@@ -550,8 +552,9 @@ private RefConcurrentReference<K> getKeyReference(K key,
ReferenceType reference
case SOFT -> new SoftRefConcurrentReference<>(key, keyQueue);
case WEAK -> new WeakRefConcurrentReference<>(key, keyQueue);
case HARD -> new HardRefConcurrentReference<>(key, keyQueue);
- case NONE -> throw new IllegalArgumentException(
- "NONE reference type should be handled before calling
this method");
+ case NONE ->
+ throw new IllegalArgumentException(
+ "NONE reference type should be handled before
calling this method");
};
}
diff --git
a/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelValidator.java
b/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelValidator.java
index c3bc8e7320..b97064f311 100644
---
a/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelValidator.java
+++
b/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelValidator.java
@@ -1791,9 +1791,9 @@ private boolean validateProfileId(
private boolean isValidProfileId(String id) {
return switch (id.charAt(0)) { // avoid first character that has
special CLI meaning in "mvn -P xxx"
- // +: activate
- // -, !: deactivate
- // ?: optional
+ // +: activate
+ // -, !: deactivate
+ // ?: optional
case '+', '-', '!', '?' -> false;
default -> true;
};
diff --git
a/impl/maven-impl/src/main/java/org/apache/maven/impl/resolver/ArtifactDescriptorUtils.java
b/impl/maven-impl/src/main/java/org/apache/maven/impl/resolver/ArtifactDescriptorUtils.java
index a7214d5b29..a49bb2fde4 100644
---
a/impl/maven-impl/src/main/java/org/apache/maven/impl/resolver/ArtifactDescriptorUtils.java
+++
b/impl/maven-impl/src/main/java/org/apache/maven/impl/resolver/ArtifactDescriptorUtils.java
@@ -84,8 +84,8 @@ public static String toRepositoryChecksumPolicy(final String
artifactRepositoryP
case RepositoryPolicy.CHECKSUM_POLICY_FAIL ->
RepositoryPolicy.CHECKSUM_POLICY_FAIL;
case RepositoryPolicy.CHECKSUM_POLICY_IGNORE ->
RepositoryPolicy.CHECKSUM_POLICY_IGNORE;
case RepositoryPolicy.CHECKSUM_POLICY_WARN ->
RepositoryPolicy.CHECKSUM_POLICY_WARN;
- default -> throw new IllegalArgumentException(
- "unknown repository checksum policy: " +
artifactRepositoryPolicy);
+ default ->
+ throw new IllegalArgumentException("unknown repository
checksum policy: " + artifactRepositoryPolicy);
};
}
}
diff --git
a/impl/maven-impl/src/main/java/org/apache/maven/impl/resolver/relocation/UserPropertiesArtifactRelocationSource.java
b/impl/maven-impl/src/main/java/org/apache/maven/impl/resolver/relocation/UserPropertiesArtifactRelocationSource.java
index a6425adc65..a667b2a286 100644
---
a/impl/maven-impl/src/main/java/org/apache/maven/impl/resolver/relocation/UserPropertiesArtifactRelocationSource.java
+++
b/impl/maven-impl/src/main/java/org/apache/maven/impl/resolver/relocation/UserPropertiesArtifactRelocationSource.java
@@ -198,8 +198,9 @@ private static Artifact parseArtifact(String coords) {
case 3 -> new DefaultArtifact(parts[0], parts[1], "*", "*",
parts[2]);
case 4 -> new DefaultArtifact(parts[0], parts[1], "*", parts[2],
parts[3]);
case 5 -> new DefaultArtifact(parts[0], parts[1], parts[2],
parts[3], parts[4]);
- default -> throw new IllegalArgumentException("Bad artifact
coordinates " + coords
- + ", expected format is
<groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>");
+ default ->
+ throw new IllegalArgumentException("Bad artifact coordinates "
+ coords
+ + ", expected format is
<groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>");
};
return s;
}
diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/util/Os.java
b/impl/maven-impl/src/main/java/org/apache/maven/impl/util/Os.java
index 667f02ad87..e95bc0a4d4 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/util/Os.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/util/Os.java
@@ -190,9 +190,10 @@ public static boolean isFamily(String family, String
actualOsName) {
case FAMILY_DOS -> PATH_SEP.equals(";") &&
!isFamily(FAMILY_NETWARE, actualOsName) && !isWindows;
case FAMILY_MAC -> actualOsName.contains(FAMILY_MAC) ||
actualOsName.contains(DARWIN);
case FAMILY_TANDEM -> actualOsName.contains("nonstop_kernel");
- case FAMILY_UNIX -> PATH_SEP.equals(":")
- && !isFamily(FAMILY_OPENVMS, actualOsName)
- && (!isFamily(FAMILY_MAC, actualOsName) ||
actualOsName.endsWith("x"));
+ case FAMILY_UNIX ->
+ PATH_SEP.equals(":")
+ && !isFamily(FAMILY_OPENVMS, actualOsName)
+ && (!isFamily(FAMILY_MAC, actualOsName) ||
actualOsName.endsWith("x"));
case FAMILY_ZOS -> actualOsName.contains(FAMILY_ZOS) ||
actualOsName.contains(FAMILY_OS390);
case FAMILY_OS400 -> actualOsName.contains(FAMILY_OS400);
case FAMILY_OPENVMS -> actualOsName.contains(FAMILY_OPENVMS);
diff --git
a/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultModelXmlFactoryTest.java
b/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultModelXmlFactoryTest.java
index badb8612da..8a8b4b21b0 100644
---
a/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultModelXmlFactoryTest.java
+++
b/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultModelXmlFactoryTest.java
@@ -45,8 +45,7 @@ void setUp() {
@Test
void testValidNamespaceWithModelVersion400() throws Exception {
- String xml =
- """
+ String xml = """
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
</project>""";
@@ -61,8 +60,7 @@ void testValidNamespaceWithModelVersion400() throws Exception
{
@Test
void testValidNamespaceWithModelVersion410() throws Exception {
- String xml =
- """
+ String xml = """
<project xmlns="http://maven.apache.org/POM/4.1.0">
<modelVersion>4.1.0</modelVersion>
</project>""";
@@ -77,8 +75,7 @@ void testValidNamespaceWithModelVersion410() throws Exception
{
@Test
void testInvalidNamespaceWithModelVersion410() {
- String xml =
- """
+ String xml = """
<project xmlns="http://invalid.namespace/4.1.0">
<modelVersion>4.1.0</modelVersion>
</project>""";
@@ -93,8 +90,7 @@ void testInvalidNamespaceWithModelVersion410() {
@Test
void testNoNamespaceWithModelVersion400() throws Exception {
- String xml =
- """
+ String xml = """
<project>
<modelVersion>4.0.0</modelVersion>
</project>""";
@@ -114,8 +110,7 @@ void testNullRequest() {
@Test
void testMalformedModelVersion() throws Exception {
- String xml =
- """
+ String xml = """
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>invalid.version</modelVersion>
</project>""";
@@ -130,8 +125,7 @@ void testMalformedModelVersion() throws Exception {
@Test
void testWriteWithoutFormatterDisablesLocationTracking() throws Exception {
// minimal valid model we can round-trip
- String xml =
- """
+ String xml = """
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>g</groupId>
@@ -157,8 +151,7 @@ void testWriteWithoutFormatterDisablesLocationTracking()
throws Exception {
@Test
void testWriteWithFormatterEnablesLocationTracking() throws Exception {
- String xml =
- """
+ String xml = """
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>g</groupId>
diff --git
a/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultPluginXmlFactoryTest.java
b/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultPluginXmlFactoryTest.java
index e566e4d9fc..bd4d3b7b22 100644
---
a/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultPluginXmlFactoryTest.java
+++
b/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultPluginXmlFactoryTest.java
@@ -52,8 +52,7 @@
class DefaultPluginXmlFactoryTest {
private static final String NAME = "sample-plugin-" + randomUUID();
- private static final String SAMPLE_PLUGIN_XML =
- """
+ private static final String SAMPLE_PLUGIN_XML = """
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<name>%s</name>
@@ -61,8 +60,7 @@ class DefaultPluginXmlFactoryTest {
<artifactId>sample-plugin</artifactId>
<version>1.0.0</version>
</plugin>
- """
- .formatted(NAME);
+ """.formatted(NAME);
private final DefaultPluginXmlFactory defaultPluginXmlFactory = new
DefaultPluginXmlFactory();
diff --git
a/impl/maven-impl/src/test/java/org/apache/maven/impl/XmlFactoryTransformerTest.java
b/impl/maven-impl/src/test/java/org/apache/maven/impl/XmlFactoryTransformerTest.java
index aa1d3e1522..5ed05895be 100644
---
a/impl/maven-impl/src/test/java/org/apache/maven/impl/XmlFactoryTransformerTest.java
+++
b/impl/maven-impl/src/test/java/org/apache/maven/impl/XmlFactoryTransformerTest.java
@@ -47,8 +47,7 @@ void testModelXmlFactoryUsesTransformer() throws Exception {
return value;
};
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -90,8 +89,7 @@ void testSettingsXmlFactoryUsesTransformer() throws Exception
{
return value;
};
- String settingsXml =
- """
+ String settingsXml = """
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0">
<localRepository>/path/to/local/repo</localRepository>
@@ -137,8 +135,7 @@ void testToolchainsXmlFactoryUsesTransformer() throws
Exception {
return value;
};
- String toolchainsXml =
- """
+ String toolchainsXml = """
<?xml version="1.0" encoding="UTF-8"?>
<toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.1.0">
<toolchain>
@@ -195,8 +192,7 @@ void testPluginXmlFactoryUsesTransformer() throws Exception
{
return value;
};
- String pluginXml =
- """
+ String pluginXml = """
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<name>test-plugin</name>
diff --git
a/impl/maven-impl/src/test/java/org/apache/maven/impl/cache/CacheConfigurationTest.java
b/impl/maven-impl/src/test/java/org/apache/maven/impl/cache/CacheConfigurationTest.java
index 0edc19236d..5eb96fef19 100644
---
a/impl/maven-impl/src/test/java/org/apache/maven/impl/cache/CacheConfigurationTest.java
+++
b/impl/maven-impl/src/test/java/org/apache/maven/impl/cache/CacheConfigurationTest.java
@@ -116,8 +116,7 @@ void testParseWildcardSelector() {
@Test
void testParseMultipleSelectors() {
- String configString =
- """
+ String configString = """
ModelBuilderRequest { scope: session, ref: soft }
ArtifactResolutionRequest { scope: request, ref: hard }
* VersionRangeRequest { ref: weak }
@@ -271,9 +270,7 @@ void testEmptyConfiguration() {
@Test
void testPartialConfigurationMerging() {
- userProperties.put(
- Constants.MAVEN_CACHE_CONFIG_PROPERTY,
- """
+ userProperties.put(Constants.MAVEN_CACHE_CONFIG_PROPERTY, """
ModelBuilderRequest { scope: session }
* ModelBuilderRequest { ref: hard }
""");
diff --git
a/impl/maven-impl/src/test/java/org/apache/maven/impl/model/InterningTransformerTest.java
b/impl/maven-impl/src/test/java/org/apache/maven/impl/model/InterningTransformerTest.java
index 5316352658..87c10d3e19 100644
---
a/impl/maven-impl/src/test/java/org/apache/maven/impl/model/InterningTransformerTest.java
+++
b/impl/maven-impl/src/test/java/org/apache/maven/impl/model/InterningTransformerTest.java
@@ -209,8 +209,7 @@ void testTransformerIsUsedDuringPomParsing() throws
Exception {
return value;
};
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
@@ -262,8 +261,7 @@ void testTransformerIsUsedDuringPomParsing() throws
Exception {
@Test
void testInterningTransformerWithRealPomParsing() throws Exception {
- String pomXml =
- """
+ String pomXml = """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
diff --git
a/impl/maven-impl/src/test/java/org/apache/maven/impl/model/ParentCycleDetectionTest.java
b/impl/maven-impl/src/test/java/org/apache/maven/impl/model/ParentCycleDetectionTest.java
index 3fa6eb88ce..7fb2710205 100644
---
a/impl/maven-impl/src/test/java/org/apache/maven/impl/model/ParentCycleDetectionTest.java
+++
b/impl/maven-impl/src/test/java/org/apache/maven/impl/model/ParentCycleDetectionTest.java
@@ -59,9 +59,7 @@ void
testParentResolutionCycleDetectionWithRelativePath(@TempDir Path tempDir) t
// Create a parent resolution cycle using relativePath: child ->
parent -> child
// This reproduces the same issue as the integration test
MavenITmng11009StackOverflowParentResolutionTest
Path childPom = tempDir.resolve("pom.xml");
- Files.writeString(
- childPom,
- """
+ Files.writeString(childPom, """
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -78,9 +76,7 @@ void
testParentResolutionCycleDetectionWithRelativePath(@TempDir Path tempDir) t
Path parentPom = tempDir.resolve("parent").resolve("pom.xml");
Files.createDirectories(parentPom.getParent());
- Files.writeString(
- parentPom,
- """
+ Files.writeString(parentPom, """
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -132,9 +128,7 @@ void testDirectCycleDetection(@TempDir Path tempDir) throws
IOException {
// Create a direct cycle: A -> B -> A
Path pomA = tempDir.resolve("a").resolve("pom.xml");
Files.createDirectories(pomA.getParent());
- Files.writeString(
- pomA,
- """
+ Files.writeString(pomA, """
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -152,9 +146,7 @@ void testDirectCycleDetection(@TempDir Path tempDir) throws
IOException {
Path pomB = tempDir.resolve("b").resolve("pom.xml");
Files.createDirectories(pomB.getParent());
- Files.writeString(
- pomB,
- """
+ Files.writeString(pomB, """
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -203,9 +195,7 @@ void
testMultipleModulesWithSameParentDoNotCauseCycle(@TempDir Path tempDir) thr
// Create a scenario like the failing test: multiple modules with the
same parent
Path parentPom = tempDir.resolve("parent").resolve("pom.xml");
Files.createDirectories(parentPom.getParent());
- Files.writeString(
- parentPom,
- """
+ Files.writeString(parentPom, """
<project xmlns="http://maven.apache.org/POM/4.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0
https://maven.apache.org/xsd/maven-4.1.0.xsd">
<modelVersion>4.1.0</modelVersion>
@@ -218,9 +208,7 @@ void
testMultipleModulesWithSameParentDoNotCauseCycle(@TempDir Path tempDir) thr
Path moduleA = tempDir.resolve("module-a").resolve("pom.xml");
Files.createDirectories(moduleA.getParent());
- Files.writeString(
- moduleA,
- """
+ Files.writeString(moduleA, """
<project xmlns="http://maven.apache.org/POM/4.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0
https://maven.apache.org/xsd/maven-4.1.0.xsd">
<modelVersion>4.1.0</modelVersion>
@@ -236,9 +224,7 @@ void
testMultipleModulesWithSameParentDoNotCauseCycle(@TempDir Path tempDir) thr
Path moduleB = tempDir.resolve("module-b").resolve("pom.xml");
Files.createDirectories(moduleB.getParent());
- Files.writeString(
- moduleB,
- """
+ Files.writeString(moduleB, """
<project xmlns="http://maven.apache.org/POM/4.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0
https://maven.apache.org/xsd/maven-4.1.0.xsd">
<modelVersion>4.1.0</modelVersion>
diff --git
a/impl/maven-xml/src/test/java/org/apache/maven/internal/xml/XmlNodeImplTest.java
b/impl/maven-xml/src/test/java/org/apache/maven/internal/xml/XmlNodeImplTest.java
index 541b99c451..e980517194 100644
---
a/impl/maven-xml/src/test/java/org/apache/maven/internal/xml/XmlNodeImplTest.java
+++
b/impl/maven-xml/src/test/java/org/apache/maven/internal/xml/XmlNodeImplTest.java
@@ -153,8 +153,7 @@ void testCombineChildrenAppend() throws Exception {
@Test
void testAppend() throws Exception {
- String lhs =
- """
+ String lhs = """
<?xml version="1.0" encoding="UTF-8"?>
<compilerArgs combine.children="append">
<arg>-Xmaxerrs</arg>
@@ -163,8 +162,7 @@ void testAppend() throws Exception {
<arg>100</arg>
</compilerArgs>
""";
- String result =
- """
+ String result = """
<?xml version="1.0" encoding="UTF-8"?>
<compilerArgs combine.children="append">
<arg>-Xmaxerrs</arg>
@@ -324,15 +322,13 @@ void testPreserveDominantEmptyNode2() throws
XMLStreamException, IOException {
*/
@Test
void testShouldPerformAppendAtFirstSubElementLevel() throws
XMLStreamException {
- String lhs =
- """
+ String lhs = """
<top combine.children="append">
<topsub1>t1s1Value</topsub1>
<topsub1>t1s2Value</topsub1>
</top>
""";
- String rhs =
- """
+ String rhs = """
<top>
<topsub1>t2s1Value</topsub1>
<topsub1>t2s2Value</topsub1>
diff --git a/pom.xml b/pom.xml
index 6be6461238..54d34f930a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -172,6 +172,9 @@ under the License.
<xmlunitVersion>2.10.4</xmlunitVersion>
<jacocoArgLine />
+ <version.spotless-maven-plugin>3.0.0</version.spotless-maven-plugin>
+ <version.palantirJavaFormat>2.80.0</version.palantirJavaFormat>
+
<!-- Set as system property in surefire/failsafe to propagate to tests and
IT Verifier -->
<toolboxVersion>0.14.0</toolboxVersion>
</properties>
@@ -929,6 +932,10 @@ under the License.
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>com.diffplug.spotless</groupId>
+ <artifactId>spotless-maven-plugin</artifactId>
+ </plugin>
</plugins>
</build>