Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 + ".");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
Loading