Maven 2 & 3
  1. Maven 2 & 3
  2. MNG-2434

Local snapshots should be preferred over remote ones

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.4
    • Fix Version/s: 2.0.6
    • Component/s: Dependencies
    • Labels:
      None
    • Complexity:
      Intermediate
    • Number of attachments :
      0

      Description

      If you're build a project with snapshots, m2 tries to download the newest versions of the snapshots even if the local ones are newer. Interestingly later on, the local versions are used. So the download is useless.
      A complex test case for this is the Cocoon project where nearly all modules are snapshot and locally build.

        Activity

        Hide
        Jörg Schaible added a comment -

        It downloads only the metadata, but never the SNAPSHOT ... see MNG-1908

        Show
        Jörg Schaible added a comment - It downloads only the metadata, but never the SNAPSHOT ... see MNG-1908
        Hide
        Brett Porter added a comment -

        Carsten - can you confirm if this is really a dupe of MNG-1908? Are you using the plain SNAPSHOT on the remote server, or are you using the timestamped snapshots on the remote server?

        Show
        Brett Porter added a comment - Carsten - can you confirm if this is really a dupe of MNG-1908 ? Are you using the plain SNAPSHOT on the remote server, or are you using the timestamped snapshots on the remote server?
        Hide
        Carsten Ziegeler added a comment -

        I don't think that this is a dupe: It really downloads the artifacts sometimes not just the poms. We are using the plain SNAPSHOT version. Now perhaps the interesting part is that this happens during a build where these artifacts have just been created and put in the local repository. So a simplified example is, you have two modules A and B, both have the version as SNAPSHOT and B depends on A. Now you build both modules at once, first A gets build and is installed in the local repo, then B gets build, downloads a snapshot of A from the remote server, builds and then uses the local version of B. I'm not exactly sure of this last part, but upto now, everytime changes locally done to A where available in B although B downloaded a SNAPSHOT of A which could not have these local changes.
        This does not happen always, but from time to time.

        Show
        Carsten Ziegeler added a comment - I don't think that this is a dupe: It really downloads the artifacts sometimes not just the poms. We are using the plain SNAPSHOT version. Now perhaps the interesting part is that this happens during a build where these artifacts have just been created and put in the local repository. So a simplified example is, you have two modules A and B, both have the version as SNAPSHOT and B depends on A. Now you build both modules at once, first A gets build and is installed in the local repo, then B gets build, downloads a snapshot of A from the remote server, builds and then uses the local version of B. I'm not exactly sure of this last part, but upto now, everytime changes locally done to A where available in B although B downloaded a SNAPSHOT of A which could not have these local changes. This does not happen always, but from time to time.
        Hide
        David Hay added a comment -

        We see this behavior as well in Maven 2.0.4. If a new SNAPSHOT version of an artifact is deployed to the remote repository and then I do a 'mvn install' of the same artifact, building a project that depends on that SNAPSHOT will use the version in the remote repository instead of the one I just installed into my local repository (which is newer than the one on the remote repository)

        Show
        David Hay added a comment - We see this behavior as well in Maven 2.0.4. If a new SNAPSHOT version of an artifact is deployed to the remote repository and then I do a 'mvn install' of the same artifact, building a project that depends on that SNAPSHOT will use the version in the remote repository instead of the one I just installed into my local repository (which is newer than the one on the remote repository)
        Hide
        Kenney Westerhof added a comment -

        Could this be tested again with 2.0.6?

        I think there's a fix for another issue that may solve this one as a side-effect.

        Show
        Kenney Westerhof added a comment - Could this be tested again with 2.0.6? I think there's a fix for another issue that may solve this one as a side-effect.
        Hide
        Carsten Ziegeler added a comment -

        Yes, this does not happen with maven 2.0.6 any more, so it seems that this is fixed now.

        Show
        Carsten Ziegeler added a comment - Yes, this does not happen with maven 2.0.6 any more, so it seems that this is fixed now.
        Hide
        Kenney Westerhof added a comment -

        Thanks for testing!

        Marking this closed and fixed in 2.0.6.

        Show
        Kenney Westerhof added a comment - Thanks for testing! Marking this closed and fixed in 2.0.6.

          People

          • Assignee:
            Unassigned
            Reporter:
            Carsten Ziegeler
          • Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: