slachiewicz opened a new issue, #12833:
URL: https://github.com/apache/maven/issues/12833
### Affected version
3.10.0-rc-1 (fixed in 3.10.0-SNAPSHOT, see below)
### Bug description
On 3.10.0-rc-1, `maven-surefire-plugin`'s own test-scoped dependencies are
prepended to the forked test JVM classpath, ahead of the project's. Where the
plugin and the project both depend on a library, the plugin's version wins and
the project's tests run against it.
With surefire 2.22.2, the plugin's test dependencies include Mockito 2.21.0,
PowerMock 2.0.0-beta.5, Byte Buddy 1.8.17, JUnit 4.12 and fest-assert 1.4. A
project that uses Mockito 5.15.2 therefore fails:
```
java.lang.NoSuchMethodError: 'org.mockito.plugins.MockitoLogger
org.mockito.internal.configuration.plugins.Plugins.getMockitoLogger()'
```
`-X` shows the artifact entering the booter classpath:
```
[DEBUG] Adding to surefire booter test classpath:
.../org/mockito/mockito-core/2.21.0/mockito-core-2.21.0.jar Scope: test
```
and the resulting boot classpath, with the plugin's own dependencies before
the project's:
```
boot classpath: surefire-booter-2.22.2.jar surefire-api-2.22.2.jar
surefire-logger-api-2.22.2.jar
maven-shared-utils-0.9.jar jsr305-2.0.3.jar
mockito-core-2.21.0.jar byte-buddy-1.8.17.jar byte-buddy-agent-1.8.17.jar
powermock-core-2.0.0-beta.5.jar powermock-module-junit4-2.0.0-beta.5.jar
junit-4.12.jar
powermock-api-mockito2-2.0.0-beta.5.jar hamcrest-library-1.3.jar
fest-assert-1.4.jar
<project test-classes and classes> ... mockito-core-5.15.2.jar ...
```
The project's dependency graph is clean: `dependency:tree -Dverbose`
resolves only `mockito-core:5.15.2`, and the project's own `testPath` and
`projectArtifactMap` contain only 5.15.2. Nothing in the project selects 2.21.0.
### Steps to reproduce
```
git clone https://github.com/apache/incubator-xtable
cd incubator-xtable
mvn -pl xtable-api test -Dtest=TestCatalogSync
```
On JDK 11. The module declares `mockito-core` 5.15.2 and pins
`maven-surefire-plugin` 2.22.2.
### What this is not
- Not the pre-order to level-order classpath ordering change in the same
release. `-Daether.system.dependencyVisitor=preOrder` does not change the
outcome.
- Not a local repository problem. Deleting `~/.m2/repository/org/mockito`
and letting Maven refetch reproduces it, with 2.21.0 downloaded again during
the run.
### Already fixed on master
3.10.0-SNAPSHOT (`699160f89407cf418772f5d1121b36b8237989b9`, build 115 of
2026-08-25) passes the same test on the same JDK and the same local repository.
Comparing the two `-X` logs, references to `mockito-core/2.21.0` or `powermock`
on the booter classpath go from 9 on 3.10.0-rc-1 to 0 on the snapshot, while
the legitimate booter additions remain.
Filing so the fix is confirmed for 3.10.0 final rather than carried by
accident, and in case it warrants an integration test. It may share a cause
with #12521 and #12510, which are also plugin classpath failures on 3.10.0-rc-1.
3.9.11 is unaffected.
*This issue was created with AI assistance.*
--
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]