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

Reconsider seemingly useless check of artifacts' source repository introduced in Maven 3.0

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.0, 3.1.1, 3.2.5, 3.3.9, 3.5.4, 3.6.3
    • None
    • None
    • None
    • Important

    Description

      This problem of "by-nobody-really-requested check for artifacts' source repository" (just "repo-check" further on) is actually considered a bug by many Maven users. It was introduced back in Maven 3.0, 10 years ago (!). The repo-check and its practical disadvantages have been already thoroughly described for example in my blog here and discussed here within Jira: MNG-5181, MNG-5185, MNG-5289 and MNG-5883.

      TL;DR What is requested in this issue:

      1. Remove the repo-check altogether.
      2. If that's not possible, make the repo-check disabled by-default and have an option to enable it for those who need it for whatever reason.
      3. If even that is not possible, alter Maven and its warnings and errors so that they do not confuse users.
      4. Reason about the need for the repo-check, document the reasons.

      The repo-check can be somewhat avoided by passing the -llr option to Maven. AFAIK though, e. g. Eclipse's embedded Maven used for dependency resolution doesn't support this option. Another long-outstanding issue is that using the -llr option generates this warning on Maven build:

      [WARNING] Disabling enhanced local repository: using legacy is strongly discouraged to ensure build reproducibility.
      

      Generally it might make sense (possibly because of activating some quite another old part of Maven that, apart from other things, doesn't mark down the artifacts' sources to "*.repositories" files?). But when users have no other option that could be used for making their build reproducible by skipping the repo-check, then the warning doesn't make sense to them. The only other choice they have is to remove all those "*.repositories" files from their local Maven repository in order to make their builds work again.

      Another mind-blowing issue is described in MNG-5185: If an already-downloaded artifact doesn't go through the hard-coded repo-check, Maven just tells the user "the artifact could not be resolved". But you'll get the very same message when downloading an artifact really fails. So unless you dig in, these two totally different situations are not distinguishable from each other.


      Yet to date, no action was taken by Maven authors to help with any of the problems. There is also no really good (read "making-sense-in-real-life") explanation of real pros of the introduced repo-check, that would out-weight its cons, other than for example:

      The artifacts have an identity. It matters where the artifacts were downloaded from. Artifact A downloaded from X is not the same thing to Maven 3 as A downloaded from Y. This can happen when you flip your settings.xml to go from using a repository manager to using Maven Central directly for example.

      (taken from MNG-5289 comment)

      The logical question here is, to whom concretely "it matters"? Please, give examples of what could go wrong if one has downloaded a released version of an artifact and now its source repository changes or becomes unavailable.

      Please note that we shouldn't consider the very improbable case of artifacts downloaded from various repositories would have different content even though having the very same GAV. The Maven's local repository filesystem structure is not able to cope with that situation anyway, or is it?

      Finally, there is also a performance-wise con of the repo-check - Maven needs to contact the source repository every time it builds a project referencing the checked artifact as one of its dependencies. Or doesn't it?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pbodnar Petr Bodnar
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: