Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5129

Maven struggles while resolving locked snapshots by two or more simultaneously used projects.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Incomplete
    • 3.0.3
    • None
    • Dependencies
    • 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.

      Project B requires build number #2
      <dependency>
        <groupId>org.codehaus</groupId>
        <artifactId>A</artifactId>
        <version>1.0.0-20110705.132520-2</version>
      </dependency>
      
      Project C requires build number #1
      <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:

      Folder listing of the artifact dependency A (repository/org/codehaus/A/)
          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.

      Attachments

        1. maven-dependency-issue.zip
          8 kB
          Christopher Klewes

        Issue Links

          Activity

            People

              Unassigned Unassigned
              cklewes Christopher Klewes
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: