[MNG-7986] Spurious JUnit 4.12 jar on boot classpath
- Dominant language
- Java
- Stars
- 5.3k
- Forks
- 3.1k
- Avg merge
- 20h 42m
- Merged PRs (30d)
- 297
Description
**[Jean Gauthier](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=JIRAUSER303585)** opened **[MNG-7986](https://issues.apache.org/jira/browse/MNG-7986?redirect=false)** and commented
We noticed a regression in Maven 4.0.0-alpha9 for Surefire versions 2.21.0-3.0.0-M3: when specifying a dependency to JUnit 4.13, JUnit 4.12 gets added before it on the boot classpath.
This causes issues e.g. when defining a custom JUnit 4 RunListener in a project: because JUnit 4.12 is listed first, the new `testSuiteStarted` callback that was added in 4.13 does not get invoked anymore.
This can be reproduced by running `./mvnw clean test -Dorg.slf4j.simpleLogger.log.org.apache.maven.plugin.surefire.SurefirePlugin=debug` on the attached project (and setting the Maven/Surefire versions accordingly).
I have also added the output logs for the following version combinations as attachment to the ticket:
* Maven 4.0.0-alpha8 + Surefire 2.22.2 => works correctly (contains `RunListener - testSuiteStarted`)
* Maven 4.0.0-alpha9 + Surefire 2.22.2 => broken (does not contain `RunListener - testSuiteStarted`)
* Maven 4.0.0-alpha9 + Surefire 3.0.0-M4 => works correctly (contains `RunListener - testSuiteStarted`)
Please let me know in case additional information is needed.
---
**Affects:** 4.0.0-alpha-9
**Attachments:**
- [output-maven-4.0.0-alpha8-surefire-2.22.2.txt](https://issues.apache.org/jira/secure/attachment/13065517/output-maven-4.0.0-alpha8-surefire-2.22.2.txt) (_7.28 kB_)
- [output-maven-4.0.0-alpha9-surefire-2.22.2.txt](https://issues.apache.org/jira/secure/attachment/13065516/output-maven-4.0.0-alpha9-surefire-2.22.2.txt) (_10.46 kB_)
- [output-maven-4.0.0-alpha9-surefire-3.0.0-M4.txt](https://issues.apache.org/jira/secure/attachment/13065515/output-maven-4.0.0-alpha9-surefire-3.0.0-M4.txt) (_12.05 kB_)
- [reproducer.zip](https://issues.apache.org/jira/secure/attachment/13065514/reproducer.zip) (_69.50 kB_)
1 votes, 4 watchers
Contributor guide
Research direction
Start with the attached reproducer and run ./mvnw clean test with the Surefire debug logger enabled. Compare the Maven 4.0.0-alpha8 and alpha9 outputs for Surefire 2.22.2, using the 3.0.0-M4 output as a working comparison. Done means JUnit 4.12 is no longer placed ahead of the requested JUnit 4.13 and the testSuiteStarted callback is invoked.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100