Skip to content

get-classpath IT expects the Maven 3.10/4 classpath order and fails on Maven 3.9 #1813

Open

Description

@slachiewicz

The get-classpath IT fails on Maven 3.9.16, the line the plugin's <prerequisites> (3.9.0) allows. CI runs only Maven 3.10 and 4, so it does not show up there.

java.lang.AssertionError: Unexpected classpath:
  get-classpath-lib-1.0.jar:get-classpath-lib-dep-1.0.jar:get-classpath-lib-leaf-1.0.jar:get-classpath-lib-runtime-1.0.jar,
expected:
  get-classpath-lib-1.0.jar:get-classpath-lib-dep-1.0.jar:get-classpath-lib-runtime-1.0.jar:get-classpath-lib-leaf-1.0.jar
for Apache Maven 3.9.16

(local repository paths shortened)

The goal is right and the expectation is not. verify.groovy says the artifact is resolved "as for a project that depends on it, in the order of the running Maven's resolver". On Maven 3.9.16, a project that declares get-classpath-lib:1.0 as its only dependency gets the same order the goal printed:

$ mvn dependency:build-classpath   # Maven 3.9.16, get-classpath-lib-system excluded
get-classpath-lib-1.0.jar
get-classpath-lib-dep-1.0.jar
get-classpath-lib-leaf-1.0.jar
get-classpath-lib-runtime-1.0.jar

So Maven 3.9 places the transitive leaf (via dep) before the direct runtime dependency, and Maven 3.10 and 4 place it after. The script already branches on the Maven version for the leaf version (2.0 on Maven 4, through the artifact's dependencyManagement); the expected order needs the same treatment.

Proposed fix: build expected per Maven version in src/it/projects/get-classpath/verify.groovy, with leaf before runtime for Maven 3.9.x. Comparing the entries as a set would hide the order, which is part of what the goal promises.

Reproduce: mvn -P run-its verify -Dinvoker.test=get-classpath with Maven 3.9.16.

Activity

  1. arturobernalg commented on Nov 18, 2026

    @arturobernalg
    Member

    Opened #1814 with the fix: builds the expected order per Maven version, the same way the IT already does for the leaf's own version. Reproduced the failure on real Maven 3.9.16 before the fix, confirmed it passes after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions