Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Critical
-
Resolution: Unresolved
-
Affects Version/s: 2.0.8, 2.0.9
-
Fix Version/s: Issues to be reviewed for 3.x
-
Component/s: Artifacts and Repositories
-
Labels:None
-
Complexity:Intermediate
-
Number of attachments :
Description
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.