Maven
  1. Maven
  2. MNG-4056

Relax resolution of active project artifacts from the reactor with regard to artifact type

    Details

    • Type: Wish Wish
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.10, 2.1.0-M1
    • Fix Version/s: 2.1.0, 3.0-alpha-3
    • Component/s: Dependencies
    • Labels:
      None
    • Complexity:
      Intermediate
    • Number of attachments :
      1

      Description

      Right now, active project artifacts from the reactor are resolved by their exact artifact id. The distinction between artifact type and classifier gives rise to confusion for users here. For instance, the test JAR attached by jar:test-jar has the id gid:aid:test-jar:version. Hence, resolution from the reactor cache works only if users specify the dependency on the test JAR with <type>test-jar</type>, omitting <type> and just giving <classifier>tests</classifier> will not resolve the dependendy from the reactor. However, the latter approach with the classifier works once the test JAR is installed to the local repo. EJB client JARs are another example of this issue.

      Maybe we can extend the reactor resolution to do another id matching try which constructs the id of the active artifact by assuming type = artifactHandler.extension and classifier = artifactHandler.classifier before matching with the dependency id. This should more closely resemble artifact identity as visible in the repository, where we have no artifact type but only classifier and extension.

      1. MNG-4056.patch
        6 kB
        Benjamin Bentmann

        Issue Links

          Activity

          Hide
          Benjamin Bentmann added a comment - - edited

          Proposed patch, subject to discussion on dev@.

          Show
          Benjamin Bentmann added a comment - - edited Proposed patch, subject to discussion on dev@ .
          Hide
          Benjamin Bentmann added a comment -

          Fixed in r749612 and r749616, respectively.

          Show
          Benjamin Bentmann added a comment - Fixed in r749612 and r749616 , respectively.
          Hide
          Jesse Glick added a comment -

          The fix of this bug looks like it obsoletes the caveat given at the end of http://maven.apache.org/guides/mini/guide-attached-tests.html. If that is right, perhaps the guide should go back to recommending <classifier>tests</classifier>, or explain that either style will work equally well.

          Show
          Jesse Glick added a comment - The fix of this bug looks like it obsoletes the caveat given at the end of http://maven.apache.org/guides/mini/guide-attached-tests.html . If that is right, perhaps the guide should go back to recommending <classifier>tests</classifier> , or explain that either style will work equally well.
          Hide
          Etienne Lacazedieu added a comment -

          I have the same behavior with Maven 2.2.1 :

          My project yyy depends on xxx.jar (compile scope) and xxx-sources.jar (provided scope)

          The tests needs the sources dependencies (GWT unit tests)

          • When I build it using the common parent of xxx and yyy, it fails : sources are not present in the test classpath. xxx is resolved as an active project artifact
          • When I build only yyy, it works : xxx and its sources are resolved from the local maven repository.

          Works with Maven 3.0.x

          Show
          Etienne Lacazedieu added a comment - I have the same behavior with Maven 2.2.1 : My project yyy depends on xxx.jar (compile scope) and xxx-sources.jar (provided scope) The tests needs the sources dependencies (GWT unit tests) When I build it using the common parent of xxx and yyy, it fails : sources are not present in the test classpath. xxx is resolved as an active project artifact When I build only yyy, it works : xxx and its sources are resolved from the local maven repository. Works with Maven 3.0.x

            People

            • Assignee:
              Benjamin Bentmann
              Reporter:
              Benjamin Bentmann
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: