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 5c02857a96 [MNG-8384] Make sure plugin's artifacts have a scope (#1928) 5c02857a96 is described below commit 5c02857a969503ed4d502716c4d825ca3eb1b45b Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Wed Nov 20 20:04:57 2024 +0100 [MNG-8384] Make sure plugin's artifacts have a scope (#1928) --- .../src/main/java/org/apache/maven/RepositoryUtils.java | 2 +- .../maven/plugin/internal/DefaultMavenPluginManager.java | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/impl/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java b/impl/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java index d7642c836a..4a9e359d4a 100644 --- a/impl/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java +++ b/impl/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java @@ -69,7 +69,7 @@ public class RepositoryUtils { return (string == null || string.isEmpty()) ? null : string; } - private static org.apache.maven.artifact.Artifact toArtifact(Dependency dependency) { + public static org.apache.maven.artifact.Artifact toArtifact(Dependency dependency) { if (dependency == null) { return null; } diff --git a/impl/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java b/impl/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java index 945fb1fa44..dea8a94fea 100644 --- a/impl/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java +++ b/impl/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java @@ -34,7 +34,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -121,7 +120,6 @@ import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable; import org.eclipse.aether.RepositorySystemSession; import org.eclipse.aether.graph.DependencyFilter; import org.eclipse.aether.repository.RemoteRepository; -import org.eclipse.aether.resolution.ArtifactResult; import org.eclipse.aether.resolution.DependencyResult; import org.eclipse.aether.util.filter.AndDependencyFilter; import org.slf4j.Logger; @@ -463,12 +461,10 @@ public class DefaultMavenPluginManager implements MavenPluginManager { } private List<Artifact> toMavenArtifacts(DependencyResult dependencyResult) { - List<Artifact> artifacts = - new ArrayList<>(dependencyResult.getArtifactResults().size()); - dependencyResult.getArtifactResults().stream() - .filter(ArtifactResult::isResolved) - .forEach(a -> artifacts.add(RepositoryUtils.toArtifact(a.getArtifact()))); - return Collections.unmodifiableList(artifacts); + return dependencyResult.getDependencyNodeResults().stream() + .filter(n -> n.getArtifact().getPath() != null) + .map(n -> RepositoryUtils.toArtifact(n.getDependency())) + .collect(Collectors.toUnmodifiableList()); } private Map<String, ClassLoader> calcImports(