-
Feature Request
-
Resolution: Done
-
Major
-
2.1.1
-
None
I'm currently to find an effective way to filter out many dependencies at once that I could provide within a "dummy" pom.xml.
I'd like to do the following:
public static List<MavenResolvedArtifact> resolveAllTestNonTransitiveDependencies() { return Arrays.asList( Maven.resolver() .loadPomFromFile("pom.xml") .importTestDependencies().resolve() .withoutTransitivity() .asResolvedArtifact()); } public static List<MavenResolvedArtifact> resolveAllArquillianDependencies() { return Arrays.asList( Maven.resolver() .loadPomFromFile("src/test/resources/arquillian.pom.xml") .importTestDependencies().resolve() .withoutTransitivity() .asResolvedArtifact()); } public static List<MavenResolvedArtifact> resolveAllTestNonTransitiveNonArquillianDependencies() { List<MavenResolvedArtifact> testDependencies = resolveAllTestNonTransitiveDependencies(); List<MavenResolvedArtifact> arquillianDependencies = resolveAllArquillianDependencies(); List<MavenResolvedArtifact> filteredTestDependencies = new ArrayList<MavenResolvedArtifact>(); for (MavenResolvedArtifact testDependency : testDependencies) { if (!arquillianDependencies.contains(testDependency)) { filteredTestDependencies.add(testDependency); } } return filteredTestDependencies; }
The problem is that MavenResolvedArtifactImpl does not implements equals and hashCode needed for using Collection::contains method.
I think it would be safe to delegate MavenResolvedArtifactImpl / MavenArtifactInfoImpl equals and hashCode methods to the one defined in MavenCoordinateImpl
Thanks,
- is related to
-
SHRINKRES-30 ShrinkWrap should be able to exclude its own and Arquillian's -impl archives
- Open