Maven 4.0.0-rc-4 fails dependency resolution if distributionManagement is defined in parent (original) (raw)

Affected version

4.0.0-rc-4

Bug description

Using the Maven 4.0.0-rc-4 wrapper, create a project with a pom.xml containing:

<parent>
    <groupId>org.apache</groupId>
    <artifactId>apache</artifactId>
    <version>35</version>
</parent>

and

<dependencies>
    <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-client</artifactId>
        <version>3.4.1</version>
    </dependency>
</dependencies>

Run ./mvnw validate

Expected
The project validates successfully (as it does when using Maven 3.9.11 or 4.0.0-rc-3).

Actual
The validation fails with:
Could not collect dependencies for project org.example:untitled17:jar:1.0-SNAPSHOT
[ERROR] java.lang.IllegalArgumentException: Invalid Version Range Request: org.apache:apache:pom:21 < [central (https://repo.maven.apache.org/maven2, default, releases), apache.snapshots.https (https://repository.apache.org/content/repositories/snapshots, default, releases+snapshots), repository.jboss.org (https://repository.jboss.org/nexus/content/groups/public/, default, releases), distMgmtSnapshotsId({distMgmtSnapshotsId} (distMgmtSnapshotsId({distMgmtSnapshotsUrl}, default, releases+snapshots)]

Reproducer
Reproducer project attached: untitled17.zip