[Git][java-team/maven-plugin-tools][master] Restored the inference of the goal prefix for plugins with an unconventional artifactId
Emmanuel Bourg (@ebourg)
gitlab at salsa.debian.org
Fri Oct 30 11:30:43 GMT 2026
Emmanuel Bourg pushed to branch master at Debian Java Maintainers / maven-plugin-tools
Commits:
d37008d5 by Emmanuel Bourg at 2026-10-30T12:07:08+01:00
Restored the inference of the goal prefix for plugins with an unconventional artifactId
- - - - -
3 changed files:
- debian/changelog
- + debian/patches/restore-goal-prefix-inference.patch
- debian/patches/series
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+maven-plugin-tools (3.16.0-2) unstable; urgency=medium
+
+ * Team upload.
+ * Restored the inference of the goal prefix for plugins with an
+ unconventional artifactId
+
+ -- Emmanuel Bourg <ebourg at apache.org> Fri, 30 Oct 2026 12:07:02 +0100
+
maven-plugin-tools (3.16.0-1) unstable; urgency=medium
* Team upload.
=====================================
debian/patches/restore-goal-prefix-inference.patch
=====================================
@@ -0,0 +1,69 @@
+Description: Restore the inference of the goal prefix for any artifactId (reverts MPLUGIN-450)
+ Reverts https://github.com/apache/maven-plugin-tools/commit/ed4774bcd8b8d2d1f7ff1196cf7644054cb3ae14
+ MPLUGIN-450 broke the build of plexus-component-metadata (src:plexus-containers).
+Author: Emmanuel Bourg <ebourg at apache.org>
+Forwarded: not-needed
+--- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
++++ b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
+@@ -23,6 +23,7 @@
+
+ import org.apache.maven.plugin.AbstractMojo;
+ import org.apache.maven.plugin.MojoExecutionException;
++import org.apache.maven.plugin.descriptor.PluginDescriptor;
+ import org.apache.maven.plugins.annotations.Parameter;
+ import org.apache.maven.project.MavenProject;
+
+@@ -84,24 +85,28 @@
+ return;
+ }
+
+- if (goalPrefix == null || goalPrefix.isEmpty()) {
+- goalPrefix = getDefaultGoalPrefix(project);
+- }
+- if (goalPrefix == null || goalPrefix.isEmpty()) {
+- throw new MojoExecutionException("You need to specify a goalPrefix as it can not be correctly computed");
++ String defaultGoalPrefix = getDefaultGoalPrefix(project);
++
++ if (goalPrefix == null) {
++ goalPrefix = defaultGoalPrefix;
++ } else if (!goalPrefix.equals(defaultGoalPrefix)) {
++ getLog().warn(LS + LS + "Goal prefix is specified as: '" + goalPrefix + "'. "
++ + "Maven currently expects it to be '" + defaultGoalPrefix + "'." + LS);
+ }
+
+ generate();
+ }
+
+ static String getDefaultGoalPrefix(MavenProject project) {
+- String artifactId = project.getArtifactId();
+- if (artifactId.endsWith("-maven-plugin")) {
+- return artifactId.substring(0, artifactId.length() - "-maven-plugin".length());
+- } else if (artifactId.startsWith("maven-") && artifactId.endsWith("-plugin")) {
+- return artifactId.substring("maven-".length(), artifactId.length() - "-plugin".length());
++ String defaultGoalPrefix;
++ if ("maven-plugin-report-plugin".equalsIgnoreCase(project.getArtifactId())) {
++ defaultGoalPrefix = "plugin-report";
++ } else if ("maven-plugin".equalsIgnoreCase(project.getArtifactId())) {
++ defaultGoalPrefix =
++ project.getGroupId().substring(project.getGroupId().lastIndexOf('.') + 1);
+ } else {
+- return null;
++ defaultGoalPrefix = PluginDescriptor.getGoalPrefixFromArtifactId(project.getArtifactId());
+ }
++ return defaultGoalPrefix;
+ }
+ }
+--- a/maven-plugin-plugin/src/test/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojoTest.java
++++ b/maven-plugin-plugin/src/test/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojoTest.java
+@@ -35,7 +35,10 @@
+ arguments(null, "maven-plugin-plugin", "plugin"),
+ arguments(null, "maven-plugin-report-plugin", "plugin-report"),
+ arguments(null, "maven-default-plugin", "default"),
+- arguments(null, "default-maven-plugin", "default"));
++ arguments(null, "default-maven-plugin", "default"),
++ arguments(null, "default-maven-plugin", "default"),
++ arguments("foo.bar", "maven-plugin", "bar"),
++ arguments("foo", "maven-plugin", "foo"));
+ }
+
+ @ParameterizedTest
=====================================
debian/patches/series
=====================================
@@ -1 +1,2 @@
add-sisu-maven-plugin.patch
+restore-goal-prefix-inference.patch
View it on GitLab: https://salsa.debian.org/java-team/maven-plugin-tools/-/commit/d37008d5a07cded85e14df40e33fdb826d57ed52
--
View it on GitLab: https://salsa.debian.org/java-team/maven-plugin-tools/-/commit/d37008d5a07cded85e14df40e33fdb826d57ed52
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20261030/55e8d3f6/attachment.htm>
More information about the pkg-java-commits
mailing list