Hi,

I recently created a patch for MNG-4056 and would appreciate some comments whether that's the proper way to address the issue.

In short, this issue is about the subtle difference between

  <dependency>
    <groupId>gid</groupId>
    <artifactId>aid</artifactId>
    <version>0.1</version>
    <classifier>tests</classifier>
  </dependency>

and

  <dependency>
    <groupId>gid</groupId>
    <artifactId>aid</artifactId>
    <version>0.1</version>
    <type>test-jar</type>
  </dependency>

i.e. <type>test-jar</type> vs. <classifier>tests</classifier>. While both declarations work during builds of the consumer project that run up to the "install" phase, only the latter declaration will allow proper dependency resolution from the reactor during an earlier lifecycle phase like "package" (see also comments in MNG-2045 [0]).

The cause for this difference is that resolution from the reactor matches artifacts by their dependency conflict id which has the form gid:aid:type:classifier. For the first dependency declaration above, the type is "jar" which doesn't match the type "test-jar" as used for the attached test JAR.

In case matching by dependency conflict id fails, the proposed patch falls back to another id I called repository conflict id (well, it needed to have a name...). The important difference is that the repository conflict id has the form gid:aid:extension:classifier, i.e. uses the file extension instead of the type.

The rationale for this approach is the observation that the repository layout does not use the artifact type but the file extension to distinguish files. In other words, the ids
  gid:aid:test-jar:tests:0.1
and
  gid:aid:jar:tests:0.1
get mapped to the same physical file in the repository, namely
  gid/aid/0.1/aid-0.1/aid-0.1-tests.jar
i.e. there's an aliasing effect in the repository which the patch mimics for dependency resolution from the reactor.

It solves the problem from a user's perspective but I'm not sure whether this kind of artifact identity is clean from a design perspective. WDYT?


Benjamin


[0] http://jira.codehaus.org/browse/MNG-2045?focusedCommentId=152064&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_152064

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to