torsten-liermann opened a new pull request, #2226: URL: https://github.com/apache/maven-resolver/pull/2226
Fixes #2225. `newResolutionRepositories` runs mirror selection again for repositories that already list mirrored repositories. A single `*` mirror turns `corp[central]` into `corp[corp[central]]` (mirror[mirrored repositories]). With several mirrors, a wildcard mirror can replace an exact mirror, a working HTTP mirror can become blocked, and a repository blocked by the default HTTP blocker can be redirected to a mirror that is not blocked. This change skips mirror selection for build-supplied repositories that already list mirrored repositories. Proxy and authentication selection and merging still apply. Repositories declared by a remote artifact descriptor still go through mirror selection, as before. The Javadoc of `newResolutionRepositories` and of both `aggregateRepositories` overloads states the rule. Maven 4.0.0-rc-7 (Resolver 2.0.23) is affected in a plain `mvn validate` that downloads the parent POM through such mirrors; the issue shows three such builds. With the Resolver jars of rc-7 replaced by a build of this change, all three give the Maven 3.10.0 results. Maven 3.10.0 (Resolver 2.0.24) keeps the first selection in these builds, and no class outside Resolver in its distribution references `newResolutionRepositories`. Plugins and extensions that pass prepared repositories to it get the repeated selection with 2.0.24. A JUnit 4 backport for `maven-resolver-1.9.x` follows as a separate PR. Compatibility: callers that pass already mirrored repositories, Maven 4 included, keep the first mirror selection, also after a session or selector change. Where the mirror selector matches the selected mirror itself, the result can differ from today in its mirrored repositories, target server, blocked state and number of repositories. In the issue's row 4 build, rc-7 resolves the parent through `corp` today; with this change it fails with `Blocked mirror for repositories: [foo …]`, as Maven 3.10.0 does. Callers that want a new mirror decision must pass the original repository definitions. Tests cover wildcard self-mirroring, an exact plus a wildcard mirror, merging with raw and with other prepared repositories, both HTTP-blocking directions, a changed session, and the unchanged descriptor selection. Validation: in the earlier regression control on this same patch, with the unchanged `DefaultRemoteRepositoryManager`, 10 of the 33 tests in `DefaultRemoteRepositoryManagerTest` and `DefaultRepositorySystemTest` failed. A fresh `-pl maven-resolver-impl -am clean verify` run passes (1281 tests, one existing skip), including all 33 tests in these two classes. `spotless:check` passes across all modules. A full reactor build and the integration tests were not run. --- To make clear that you license your contribution under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) check one of the following: - [x] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) - [ ] I hereby declare that I have filed an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
