Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Incomplete
-
3.0.3
-
None
-
None
Description
This has to be explained with an easy example. Given that we have three projects (A, B and C). Both projects B and C has a dependency to a locked snapshot of project A.
<dependency> <groupId>org.codehaus</groupId> <artifactId>A</artifactId> <version>1.0.0-20110705.132520-2</version> </dependency>
<dependency> <groupId>org.codehaus</groupId> <artifactId>A</artifactId> <version>1.0.0-20110705.132120-1</version> </dependency>
We now call dependency:resolve on each projects to resolve their dependencies from the repositories. As we can see in our local repository both versions are fetched and downloaded from their respective repository server. Unfortunately a last one wins conflict occurs. The project on which dependency:resolve is called last wins the race. Maven typically copies the latest fetched snapshot version (even if it's locked!) to the default version. Let's have a look at the folder structure:
maven-metadata-local.xml maven-metadata-opensaga.xml maven-metadata-opensaga.xml.sha1 A-1.0.0-20110705.132120-1.jar A-1.0.0-20110705.132120-1.pom A-1.0.0-20110705.132520-2.jar A-1.0.0-20110705.132520-2.pom A-1.0.0-SNAPSHOT.jar (the last fetched snapshot version) A-1.0.0-SNAPSHOT.pom
The last version will be copied to the file A-1.0.0-SNAPSHOT.jar. Maven references their dependencies to the file without the exactt timestamp/buildnumber. This fact make it impossible to develop the project B and C or even run them simultaneously, because only the last one wins.
It would be mandatory to exactly reference the file with the timestamp of each project!
What do you think on this issue? I submitted the project structure so you can easily reproduce this issue.