maven icon indicating copy to clipboard operation
maven copied to clipboard

[MNG-8050] emit warn in case of repo id clashes between settings and POM

Open kwin opened this issue 1 year ago • 7 comments

Following this checklist to help us incorporate your contribution quickly and easily:

  • [ ] Make sure there is a JIRA issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
  • [ ] Each commit in the pull request should have a meaningful subject line and body.
  • [ ] Format the pull request title like [MNG-XXX] SUMMARY, where you replace MNG-XXX and SUMMARY with the appropriate JIRA issue.
  • [ ] Also format the first line of the commit message like [MNG-XXX] SUMMARY. Best practice is to use the JIRA issue title in both the pull request title and in the first line of the commit message.
  • [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • [ ] Run mvn clean verify to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • [ ] You have run the Core IT successfully.

If your pull request is about ~20 lines of code you don't need to sign an Individual Contributor License Agreement if you are unsure please ask on the developers list.

To make clear that you license your contribution under the Apache License Version 2.0, January 2004 you have to acknowledge this by using the following check-box.

kwin avatar Feb 13 '24 18:02 kwin

@gnodet ?

cstamas avatar Feb 15 '24 20:02 cstamas

If there are no concerns I am gonna merge end of next week @gnodet.

kwin avatar Mar 01 '24 13:03 kwin

@kwin Should we check that the repositories are actually not the same ? What's the problem is they point to the same repo ? If the user simply wants to override the policy in the settings ?

BTW, I think the mapping from an id to a repository URI should actually be defined in the local repository. I think two projects using the same id but pointing to different repositories might be problematic too.

gnodet avatar Mar 01 '24 17:03 gnodet

@gnodet I now only emit warning if the URLs differ (https://github.com/apache/maven/commit/cd7aba6af6ff80a394e12b975a293fa07cb813c9)

I think the mapping from an id to a repository URI should actually be defined in the local repository

Not sure how this can ever be achieved. I still want to be able to clone arbitrary projects and build it immediately without needing to tweak either my settings.xml or some other Maven configuration file.

kwin avatar Mar 04 '24 10:03 kwin

@gnodet I now only emit warning if the URLs differ (cd7aba6)

I think the mapping from an id to a repository URI should actually be defined in the local repository

Not sure how this can ever be achieved. I still want to be able to clone arbitrary projects and build it immediately without needing to tweak either my settings.xml or some other Maven configuration file.

@cstamas can the resolver provide any help here ?

gnodet avatar Mar 11 '24 07:03 gnodet

Sadly nope.

IMHO the best we can do is to accept the facts:

  • repository ID is the "key" (so assume URL is "just" an attribute) and limit ourselves onto ID clash checking
  • maybe as improvement, warn (optionally fail) the build, if there are two different IDs with same URLs?
  • cases when same ID may be used for different reposes (or when different IDs are used for same repository) mostly stands for us, people that check out various project, having various "repo naming conventions" (as for example, ideally within one company or even forge, this should be unified) is we simply cannot handle.

cstamas avatar Mar 21 '24 14:03 cstamas

@gnodet I think we should also warn if the URL is equal but the <enabled> flags for either <release> or <snapshot> differ. Otherwise this might lead to subtle issues which are hard to debug.

kwin avatar Mar 21 '24 19:03 kwin

I think we should also warn if the URL is equal but the flags for either or differ. Otherwise this might lead to subtle issues which are hard to debug.

I decided to ignore those subtle differences for now.

kwin avatar May 18 '24 13:05 kwin