Skip to content

Commit 5c02857

Browse files
authored
[MNG-8384] Make sure plugin's artifacts have a scope (#1928)
1 parent 377bc31 commit 5c02857

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

impl/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private static String nullify(String string) {
6969
return (string == null || string.isEmpty()) ? null : string;
7070
}
7171

72-
private static org.apache.maven.artifact.Artifact toArtifact(Dependency dependency) {
72+
public static org.apache.maven.artifact.Artifact toArtifact(Dependency dependency) {
7373
if (dependency == null) {
7474
return null;
7575
}

impl/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import java.nio.file.Path;
3535
import java.util.ArrayList;
3636
import java.util.Collection;
37-
import java.util.Collections;
3837
import java.util.HashMap;
3938
import java.util.List;
4039
import java.util.Map;
@@ -121,7 +120,6 @@
121120
import org.eclipse.aether.RepositorySystemSession;
122121
import org.eclipse.aether.graph.DependencyFilter;
123122
import org.eclipse.aether.repository.RemoteRepository;
124-
import org.eclipse.aether.resolution.ArtifactResult;
125123
import org.eclipse.aether.resolution.DependencyResult;
126124
import org.eclipse.aether.util.filter.AndDependencyFilter;
127125
import org.slf4j.Logger;
@@ -463,12 +461,10 @@ private List<org.eclipse.aether.artifact.Artifact> toAetherArtifacts(final List<
463461
}
464462

465463
private List<Artifact> toMavenArtifacts(DependencyResult dependencyResult) {
466-
List<Artifact> artifacts =
467-
new ArrayList<>(dependencyResult.getArtifactResults().size());
468-
dependencyResult.getArtifactResults().stream()
469-
.filter(ArtifactResult::isResolved)
470-
.forEach(a -> artifacts.add(RepositoryUtils.toArtifact(a.getArtifact())));
471-
return Collections.unmodifiableList(artifacts);
464+
return dependencyResult.getDependencyNodeResults().stream()
465+
.filter(n -> n.getArtifact().getPath() != null)
466+
.map(n -> RepositoryUtils.toArtifact(n.getDependency()))
467+
.collect(Collectors.toUnmodifiableList());
472468
}
473469

474470
private Map<String, ClassLoader> calcImports(

0 commit comments

Comments
 (0)