apache / apache/maven-surefire

[SUREFIRE-1557] Test modular build on Java 10

Open
#2,240 2 comments 0 reactions 0 assignees View on GitHub
enhancement priority:major
Dominant language
Java
Stars
461
Forks
588
Avg merge
1d 8h
Merged PRs (30d)
19

Description

**[Tor Egil Jacobsen](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=jactor)** opened **[SUREFIRE-1557](https://issues.apache.org/jira/browse/SUREFIRE-1557?redirect=false)** and commented

A modular build on GitHub, [jactor-rises](https://github.com/jactor-rises/jactor-rises/tree/feature/junit.jupiter_configuration), fails when running with surefire 2.22.0

All tests run perfectly fine in my IntelliJ idea. When building with maven, all surefire reports fails with an `InaccessableObjectException` with message similar to this one: `java.lang.reflect.InaccessibleObjectException: Unable to make com.github.jactor.rises.commons.dto.UserDtoTest() accessible: module jactor.rises.commons does not "opens com.github.jactor.rises.commons.dto" to unnamed module @3fc2959f`

If one deletes all `module-info.java` files, the build succeeds. I thought that during unit testing, the module should be opened by the surefire plugin. It beats the purpose of having modular jar-files if we need to open the module in order to test it...

Based on the issue created for the junit-team: [junit5-jupiter-starter-maven out of date?](https://github.com/junit-team/junit5-samples/issues/81)

---

**Affects:** 2.22.0

1 votes, 5 watchers

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure in the jactor-rises feature/junit.jupiter_configuration build with Surefire 2.22.0 and inspect its module-info.java files. Read the linked JUnit 5 Maven example and the Surefire modular-test setup. Done means the Maven test build succeeds with module-info.java files present and without the reported InaccessibleObjectException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.