Uploaded image for project: 'ShrinkWrap Resolvers'
  1. ShrinkWrap Resolvers
  2. SHRINKRES-190

implements equals and hashCode methods in MavenResolvedArtifactImpl / MavenArtifactInfoImpl

    XMLWordPrintable

Details

    • Feature Request
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Done
    • 2.1.1
    • 2.2.0-beta-1
    • maven
    • None

    Description

      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,

      Attachments

        Issue Links

          Activity

            People

              kpiwko Karel Piwko
              mathieu@mathieulachance.com Mathieu Lachance
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: