Wrong repository used in artifact resolution for a transitive dependency that
is also declared as a managed artifact with a different version
---------------------------------------------------------------------------------------------------------------------------------------------
Key: MNG-3737
URL: http://jira.codehaus.org/browse/MNG-3737
Project: Maven 2
Issue Type: Bug
Components: Artifacts and Repositories
Affects Versions: 2.0.9, 2.0.8
Reporter: Daniel Uribe
Priority: Critical
I am creating a 2.1-SNAPSHOT version of artifact A, which is the only version
of artifact A stored in our Local Repository. All other release versions (old
and new) of artifact A are stored in the Maven Central Repository.
My project is multi-module. The parent POM declares that version 2.1-SNAPSHOT
of artifact A should be used. A child module has a dependency to artifact B,
which in turn depends on version 1.0 of artifact A. Version 1.0 of artifact A
is stored in the Central repository.
I have been debugging the code, and it seems that the problem is the
DefaultArtifactCollector.
- Initially, it finds that B depends on A version 1.0 and using the repository
metadata, it determines that it can be found in the Central repository, hence
the DefaultArtifact object has its repository property set with the Central
repository.
- Later on in the process, still inside DefaultArtifactCollector, it finds that
the dependency is managed (because the parent POM defines the version to use)
and calls the manageArtifact() method. The problem is that this call only sets
the scope and version, it doesn't clear the repository property from the
DefaultArtifact object. I am almost sure this is what causes Maven to then try
to download version 2.1-SNAPSHOT artifact from Central repository, instead of
getting it from the Local repository.
This may be related to MNG-2438, but in my case none of the repositories are
legacy.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira