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

Maven resolver unable to resolve test-jar dependency

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.0.0-alpha-7
    • 2.0.0-alpha-6
    • None
    • None

      A possible regression as similar code, using the old API, worked for me with Shrinkwrap-1.

      Example: given the following dependency in the local pom.xml:
      <dependencies>
      ...
      <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>rhq-core-client-api</artifactId>
      <version>${project.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
      </dependency>
      ...
      </dependencies>

      And the following SW-2 code:

      MavenResolverSystem resolver = Maven.resolver();
      resolver.loadPomFromFile("pom.xml").resolve("org.rhq:rhq-core-client-api:jar:tests:4.6.0-SNAPSHOT).withTransitivity().as(JavaArchive.class)

      I don't get an exception but the retuened Archive is the production jar:

      rhq-core-client-api-4.6.0-SNAPSHOT.jar

      As opposed to the expected test jar:

      rhq-core-client-api-4.6.0-SNAPSHOT-tests.jar

      The test jar is generated by us in that module's pom, using the maven-jar plugin with phase=package and goal=test-jar, which I believe is the standard mechanism. And both of the jars are available in my M2 repo in the same place (.m2/repository/org/rhq/rhq-core-client-api/4.6.0-SNAPSHOT).

      At the moment I have not been able to find a workaround.

              kpiwko Karel Piwko
              rhn-engineering-jshaughn Jay Shaughnessy
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: