You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2026/09/28 12:29:02 UTC
(maven-artifact-plugin) 01/01: Remove use of deprecated MessageUtils
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch fix-messageutils-deprecation
in repository https://gitbox.apache.org/repos/asf/maven-artifact-plugin.git
commit 33dc36a733bf4c6a8b8bd2eea91f302d49bd969a
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Mon Sep 28 12:28:52 2026 +0000
Remove use of deprecated MessageUtils
maven-shared-utils 3.5.0 deprecates org.apache.maven.shared.utils.logging
MessageUtils, which now warns at every call site.
The suggested replacement is Maven's MessageBuilderFactory, but that
requires Maven 3.10.0 (or the org.apache.maven.api.services variant from
Maven 4) while this plugin's prerequisite is still Maven 3.6.3, and
MessageBuilder itself is deprecated in the same release. So rather than
raise prerequisites for a cosmetic feature, drop the styling: the affected
messages are now plain text.
The messages themselves are unchanged. With style.color=never the output is
byte-for-byte identical to before, verified for describe-build-output and
for the compare summary and mismatch lines; the .buildinfo/.buildcompare
files were never affected. The only difference is that the plugin no longer
emits ANSI escape sequences of its own -- Maven's own [INFO]/[ERROR] prefix
coloring is untouched.
With maven-shared-utils now unused, drop the dependency too, along with
its comment noting it existed only for MessageUtils.
---
pom.xml | 6 ------
.../maven/plugins/artifact/buildinfo/CompareMojo.java | 17 ++++++-----------
.../artifact/buildinfo/DescribeBuildOutputMojo.java | 18 ++++--------------
3 files changed, 10 insertions(+), 31 deletions(-)
diff --git a/pom.xml b/pom.xml
index eda0207..b6ded91 100644
--- a/pom.xml
+++ b/pom.xml
@@ -116,12 +116,6 @@
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-xml</artifactId>
</dependency>
- <!-- ONLY: MessageUtil -->
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-shared-utils</artifactId>
- <version>3.5.0</version>
- </dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-archiver</artifactId>
diff --git a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/CompareMojo.java b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/CompareMojo.java
index 7f4643b..47fb008 100644
--- a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/CompareMojo.java
+++ b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/CompareMojo.java
@@ -40,7 +40,6 @@ import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.rtinfo.RuntimeInformation;
-import org.apache.maven.shared.utils.logging.MessageUtils;
import org.apache.maven.toolchain.ToolchainManager;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
@@ -198,15 +197,12 @@ public class CompareMojo extends AbstractBuildinfoMojo {
int missing = missingFilenames.size();
if (ko + missing > 0) {
- getLog().error("[Reproducible Builds] rebuild comparison result: "
- + MessageUtils.buffer().success(ok + " files match")
- + ", " + MessageUtils.buffer().failure(ko + " differ")
- + ((missing == 0) ? "" : (", " + MessageUtils.buffer().failure(missing + " missing")))
- + ((ignored.isEmpty()) ? "" : (", " + MessageUtils.buffer().warning(ignored.size() + " ignored"))));
+ getLog().error("[Reproducible Builds] rebuild comparison result: " + ok + " files match, " + ko + " differ"
+ + ((missing == 0) ? "" : (", " + missing + " missing"))
+ + ((ignored.isEmpty()) ? "" : (", " + ignored.size() + " ignored")));
} else {
- getLog().info("[Reproducible Builds] rebuild comparison result: "
- + MessageUtils.buffer().success(ok + " files match")
- + ((ignored.isEmpty()) ? "" : (", " + MessageUtils.buffer().warning(ignored.size() + " ignored"))));
+ getLog().info("[Reproducible Builds] rebuild comparison result: " + ok + " files match"
+ + ((ignored.isEmpty()) ? "" : (", " + ignored.size() + " ignored")));
}
// save .compare file
@@ -296,8 +292,7 @@ public class CompareMojo extends AbstractBuildinfoMojo {
if (issue != null) {
String diffoscope = diffoscope(artifact, referenceDir);
- getLog().error(issue + " mismatch " + MessageUtils.buffer().strong(actualFilename) + ": investigate with "
- + MessageUtils.buffer().project(diffoscope));
+ getLog().error(issue + " mismatch " + actualFilename + ": investigate with " + diffoscope);
return new String[] {actualFilename, diffoscope};
}
return new String[] {actualFilename, null};
diff --git a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/DescribeBuildOutputMojo.java b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/DescribeBuildOutputMojo.java
index 0b0e6ff..db8feae 100644
--- a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/DescribeBuildOutputMojo.java
+++ b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/DescribeBuildOutputMojo.java
@@ -42,7 +42,6 @@ import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.project.MavenProject;
import org.apache.maven.rtinfo.RuntimeInformation;
-import org.apache.maven.shared.utils.logging.MessageUtils;
import org.apache.maven.toolchain.ToolchainManager;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
@@ -130,11 +129,8 @@ public class DescribeBuildOutputMojo extends AbstractBuildinfoMojo {
getLog().info("artifactId: " + e.getKey() + " defined for multiple groupIds: " + e.getValue()));
getLog().info("");
- getLog().info(MessageUtils.buffer()
- .a("skip/ignore? artifactId")
- .strong("[:classifier][:extension]")
- .a(" = build-path repository-filename size [sha256]")
- .build());
+ getLog().info(
+ "skip/ignore? artifactId[:classifier][:extension] = build-path repository-filename size [sha256]");
for (MavenProject p : session.getProjects()) {
boolean skipped = isSkip(p);
@@ -203,17 +199,11 @@ public class DescribeBuildOutputMojo extends AbstractBuildinfoMojo {
String ce = ("".equals(a.getClassifier()) ? "" : (':' + a.getClassifier()))
+ ("jar".equals(a.getExtension()) ? "" : (":" + a.getExtension()));
String path = rootPath.relativize(a.getFile().toPath()).toString();
- int i = path.indexOf("target/");
- if (i >= 0) {
- path = MessageUtils.buffer().mojo(path.substring(0, i + 7)).build() + path.substring(i + 7);
- }
String remoteFilename = BuildInfoWriter.getArtifactFilename(a);
return /*a.getGroupId() + ':' +*/ a.getArtifactId() /*+ ':' + a.getVersion()*/
- + MessageUtils.buffer().strong(ce) + " = "
+ + ce + " = "
+ path + " "
- + (path.endsWith(remoteFilename)
- ? "-"
- : MessageUtils.buffer().strong(remoteFilename).build())
+ + (path.endsWith(remoteFilename) ? "-" : remoteFilename)
+ " " + a.getFile().length() + sha256;
}