Skip to content

Commit

Permalink
[MNG-8164] Session#collectDependencies(Project) does not obey exclusi…
Browse files Browse the repository at this point in the history
…ons (#1591)
  • Loading branch information
gnodet authored Jun 25, 2024
1 parent 60ff077 commit 5b4e177
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.apache.maven.api.Dependency;
import org.apache.maven.api.DependencyCoordinate;
import org.apache.maven.api.DependencyScope;
import org.apache.maven.api.Exclusion;
import org.apache.maven.api.Language;
import org.apache.maven.api.Listener;
import org.apache.maven.api.LocalRepository;
Expand Down Expand Up @@ -278,14 +279,20 @@ public org.eclipse.aether.graph.Dependency toDependency(DependencyCoordinate dep
dependency.getType().getExtension(),
dependency.getVersion().toString(),
null),
dependency.getScope().id());
dependency.getScope().id(),
dependency.getOptional(),
map(dependency.getExclusions(), this::toExclusion));
}
if (!managed && "".equals(dep.getScope())) {
dep = dep.setScope(DependencyScope.COMPILE.id());
}
return dep;
}

private org.eclipse.aether.graph.Exclusion toExclusion(Exclusion exclusion) {
return new org.eclipse.aether.graph.Exclusion(exclusion.getGroupId(), exclusion.getArtifactId(), "*", "*");
}

@Override
public List<org.eclipse.aether.artifact.Artifact> toArtifacts(Collection<Artifact> artifacts) {
return artifacts == null ? null : map(artifacts, this::toArtifact);
Expand Down

0 comments on commit 5b4e177

Please sign in to comment.