slachiewicz opened a new issue, #14010: URL: https://github.com/apache/maven/issues/14010
When the `maven-metadata.xml` of a version range cannot be downloaded, Maven 4 reports that no version matched the range. The real cause, for example a checksum failure, appears only as a warning above the error, and callers of the API do not see it at all. `Session.resolveHighestVersion` and `Session.resolveVersionRange` in [`AbstractSession`](https://github.com/apache/maven/blob/master/impl/maven-impl/src/main/java/org/apache/maven/impl/AbstractSession.java) return only `getHighestVersion()` and `getVersions()` of the `VersionRangeResolverResult`. The resolver records metadata failures in `getExceptions()` instead of throwing them, so the session methods drop them. `DefaultModelResolver` then turns the empty `Optional` into `No versions matched the requested parent version range`, and a plugin calling `resolveHighestVersion` gets the same empty result. Since Maven 4 fails on a missing checksum by default (MNG-5728), any repository without checksum files, such as a `file://` test repository, now hits this path. ### Reproducer A repository with `org.example:range-parent` versions 1.0, 1.5 and 2.0 and their `maven-metadata.xml`, but no checksum files; a child project with `<parent><version>[1.0,2.0)</version><relativePath/></parent>` and that repository in `<repositories>`. `mvn validate` on 4.0.0-rc-7: ``` [WARNING] Could not transfer metadata org.example:range-parent/maven-metadata.xml from/to local-fake (file:///…/repo): Checksum validation failed, no checksums available [ERROR] Non-resolvable parent POM org.example:range-parent:[1.0,2.0) for org.example:child:1.0: No versions matched the requested parent version range '[1.0,2.0)' and parent could not be found in reactor @ … ``` With `-c`, or with `.sha1` files in the repository, the parent resolves to 1.5. ### Expected The error names the failed download. One option: when the result has no versions and `getExceptions()` is not empty, `resolveHighestVersion` and `resolveVersionRange` throw a `VersionResolverException` with those exceptions as cause and suppressed, so both the model builder and plugins report it. An empty range with no errors keeps returning an empty result. I have reproduced this on 4.0.0-rc-7; `master` and `maven-4.0.x` have the same code but I have not run them. -- 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]
