Type: New Feature
Affects Version/s: None
Fix Version/s: None
As far as I can tell, Surefire will run tests using the traditional classpath also on Java 9. When the project that is built is a named Java 9 module (i.e. it contains a module descriptor), it'd be desirable to have a way to run the tests using the module path instead.
For that, the following things would be required:
- Adding the currently built project and its dependencies to the module path instead of the class path when forking the java process running the tests
- Adding a read edge from the currently built module to the used testing library, e.g. JUnit, if it's not present as a dependence in the module descriptor already (which it usually won't)
- Patching the classes from target/test-classes into the currently built module (as represented by the classes under target/classes)
- Opening up packages containing tests to the testing library so they can be accessed reflectively
I could perform these steps manually by applying the following configuration for the Surefire plug-in:
Ideally, an equivalent java invocation would be done by Surefire automatically when building a named module.