You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2026/10/20 23:08:29 UTC
(maven-plugin-tools) branch maven-plugin-tools-3.x updated: [MPLUGIN-515] Render requiresDependencyCollection in the goal report
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch maven-plugin-tools-3.x
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git
The following commit(s) were added to refs/heads/maven-plugin-tools-3.x by this push:
new e04bc69c [MPLUGIN-515] Render requiresDependencyCollection in the goal report
e04bc69c is described below
commit e04bc69c5bcd518144d9c004cdeb5ba90075fca3
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sat Sep 19 12:21:19 2026 +0200
[MPLUGIN-515] Render requiresDependencyCollection in the goal report
GoalRenderer only rendered the attribute for an ExtendedMojoDescriptor,
but the report reads descriptors back from plugin.xml as plain
MojoDescriptors, so the branch never ran. The value is on MojoDescriptor
itself since maven-plugin-api 3.x.
---
.../it/plugin-report-annotations/src/main/java/org/MyMojo.java | 1 +
.../src/it/plugin-report-annotations/verify.groovy | 3 +++
.../java/org/apache/maven/plugin/plugin/report/GoalRenderer.java | 8 +-------
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/maven-plugin-report-plugin/src/it/plugin-report-annotations/src/main/java/org/MyMojo.java b/maven-plugin-report-plugin/src/it/plugin-report-annotations/src/main/java/org/MyMojo.java
index d2f2e77f..6b7b3030 100644
--- a/maven-plugin-report-plugin/src/it/plugin-report-annotations/src/main/java/org/MyMojo.java
+++ b/maven-plugin-report-plugin/src/it/plugin-report-annotations/src/main/java/org/MyMojo.java
@@ -35,6 +35,7 @@ import org.apache.maven.plugins.annotations.ResolutionScope;
name = "noop",
defaultPhase = LifecyclePhase.PROCESS_SOURCES,
requiresDependencyResolution = ResolutionScope.TEST,
+ requiresDependencyCollection = ResolutionScope.COMPILE,
requiresDirectInvocation = true,
requiresOnline = true,
inheritByDefault = false,
diff --git a/maven-plugin-report-plugin/src/it/plugin-report-annotations/verify.groovy b/maven-plugin-report-plugin/src/it/plugin-report-annotations/verify.groovy
index ea819a14..37d86bac 100644
--- a/maven-plugin-report-plugin/src/it/plugin-report-annotations/verify.groovy
+++ b/maven-plugin-report-plugin/src/it/plugin-report-annotations/verify.groovy
@@ -40,3 +40,6 @@ assert noopMojo.isFile()
// deprecated in table and details
assert noopMojo.text.count('<div><strong>Deprecated.</strong><br />Just testing.</div><br />') == 2
+// MPLUGIN-515: both dependency scopes are rendered as goal attributes
+assert noopMojo.text.contains('Requires dependency resolution of artifacts in scope: <code>test</code>.')
+assert noopMojo.text.contains('Requires dependency collection of artifacts in scope: <code>compile</code>.')
diff --git a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/GoalRenderer.java b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/GoalRenderer.java
index daceb5be..23f85353 100644
--- a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/GoalRenderer.java
+++ b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/GoalRenderer.java
@@ -42,7 +42,6 @@ import org.apache.maven.plugin.descriptor.Parameter;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
import org.apache.maven.tools.plugin.EnhancedParameterWrapper;
-import org.apache.maven.tools.plugin.ExtendedMojoDescriptor;
import org.apache.maven.tools.plugin.javadoc.JavadocLinkGenerator;
import org.apache.maven.tools.plugin.util.PluginUtils;
import org.codehaus.plexus.i18n.I18N;
@@ -169,12 +168,7 @@ public class GoalRenderer extends AbstractPluginReportRenderer {
renderAttribute(descriptor.isAggregator(), "aggregator");
renderAttribute(descriptor.isDirectInvocationOnly(), "directInvocationOnly");
renderAttribute(descriptor.isDependencyResolutionRequired(), "dependencyResolutionRequired");
-
- if (descriptor instanceof ExtendedMojoDescriptor) {
- ExtendedMojoDescriptor extendedDescriptor = (ExtendedMojoDescriptor) descriptor;
- renderAttribute(extendedDescriptor.getDependencyCollectionRequired(), "dependencyCollectionRequired");
- }
-
+ renderAttribute(descriptor.getDependencyCollectionRequired(), "dependencyCollectionRequired");
renderAttribute(descriptor.isThreadSafe(), "threadSafe");
renderAttribute(!descriptor.isThreadSafe(), "notThreadSafe");
renderAttribute(descriptor.getSince(), "since");