apache / apache/maven-surefire
[SUREFIRE-2191] surefire crashes on a JPMS modularized project that uses junit5
- Dominant language
- Java
- Stars
- 461
- Forks
- 588
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 19
Description
**[Henning Schmiedehausen](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=henning)** opened **[SUREFIRE-2191](https://issues.apache.org/jira/browse/SUREFIRE-2191?redirect=false)** and commented
clone this repository: [https://github.com/hgschmie/surefire-2191](https://github.com/hgschmie/surefire-2191) and build it.
The build fails during testing with a large and cryptic error description. The code only uses the junit jupiter APIs and imports the with ` requires transitive org.junit.jupiter.api;`
This is the surefireargs file that the plugin creates:
```
--module-path
"/Users/henning/scratch/surefire-junit-bug/target/classes:/Users/henning/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.10.0/junit-jupiter-api-5.10.0.jar:/Users/henning/.m2/repository/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar:/Users/henning/.m2/repository/org/junit/platform/junit-platform-commons/1.10.0/junit-platform-commons-1.10.0.jar:/Users/henning/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar"
--class-path
"/Users/henning/.m2/repository/org/apache/maven/surefire/surefire-api/3.1.2/surefire-api-3.1.2.jar:/Users/henning/.m2/repository/org/apache/maven/surefire/surefire-booter/3.1.2/surefire-booter-3.1.2.jar:/Users/henning/.m2/repository/org/apache/maven/surefire/surefire-extensions-spi/3.1.2/surefire-extensions-spi-3.1.2.jar:/Users/henning/.m2/repository/org/apache/maven/surefire/surefire-logger-api/3.1.2/surefire-logger-api-3.1.2.jar:/Users/henning/.m2/repository/org/apache/maven/surefire/surefire-shared-utils/3.1.2/surefire-shared-utils-3.1.2.jar:/Users/henning/scratch/surefire-junit-bug/target/test-classes:/Users/henning/.m2/repository/org/assertj/assertj-core/3.24.2/assertj-core-3.24.2.jar:/Users/henning/.m2/repository/net/bytebuddy/byte-buddy/1.12.21/byte-buddy-1.12.21.jar:/Users/henning/.m2/repository/org/apache/maven/surefire/surefire-junit-platform/3.1.2/surefire-junit-platform-3.1.2.jar:/Users/henning/.m2/repository/org/apache/maven/surefire/common-java5/3.1.2/common-java5-3.1.2.jar:/Users/henning/.m2/repository/org/junit/platform/junit-platform-launcher/1.10.0/junit-platform-launcher-1.10.0.jar:/Users/henning/.m2/repository/org/junit/platform/junit-platform-engine/1.10.0/junit-platform-engine-1.10.0.jar:/Users/henning/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0.jar"
--patch-module
surefire.junit.bug="/Users/henning/scratch/surefire-junit-bug/target/test-classes"
--add-opens
surefire.junit.bug/demo=ALL-UNNAMED
--add-modules
surefire.junit.bug
--add-reads
surefire.junit.bug=ALL-UNNAMED
org.apache.maven.surefire.booter.ForkedBooter
```
It is not clear to me on how to fix/mitigate this error. The same build works fine without JPMS modules or with automatic versioned modules.
---
**Affects:** 3.1.2
2 votes, 4 watchers
Contributor guide
Research direction
Clone the linked surefire-2191 repository and run its build to reproduce the failure during testing. Start by inspecting the generated surefireargs file and the JPMS module-path, patch-module, and add-reads options; done means the modularized JUnit 5 project builds and tests successfully without the cryptic crash.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100