apache / apache/maven-surefire
[SUREFIRE-1543] running tests when application is a java9 module seems to be broken
- Dominant language
- Java
- Stars
- 461
- Forks
- 588
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 19
Description
**[Michał Zegan](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=webczat)** opened **[SUREFIRE-1543](https://issues.apache.org/jira/browse/SUREFIRE-1543?redirect=false)** and commented
I tried to modularize my library. I turned it into a named module. Some of my dependencies are modules, however most of them are not, so I wanted to use them as automatic modules.
However, it seems that for some reason, surefire puts quite a lot of things including many of automatic modules in the classpath instead of module path. Even worse, slf4j-simple-1.8.0-beta2, that is in test classpath and not directly required by my module, is also put in classpath, even though it is a named module!
Also, as can be seen in attached logs, my tests try to instantiate a jaxb context, however it fails because jaxb implementation, put by surefire in classpath (unnamed module) cannot access the model package, even though the package in my library is opened to java.bind. Not sure if it would currently work if I somehow forced jaxb impls to go on modulepath, however it seems putting those deps in classpath may interfere with test results. adding --add-opens to open all library packages to all unnamed modules is not an option for this exact reason, because it doesn't verify if module is properly configured, correctly opening the package to java.xml.bind module.
---
**Affects:** 2.22.0
**Attachments:**
- [2018-07-25T23-04-55_763-jvmRun1.dump](https://issues.apache.org/jira/secure/attachment/12933095/2018-07-25T23-04-55_763-jvmRun1.dump) (_3.00 kB_)
- [log](https://issues.apache.org/jira/secure/attachment/12933097/log) (_166.95 kB_)
- [module-info.java](https://issues.apache.org/jira/secure/attachment/12933099/module-info.java) (_2.09 kB_)
- [surefireargs8788494900922906864](https://issues.apache.org/jira/secure/attachment/12933096/surefireargs8788494900922906864) (_3.16 kB_)
Contributor guide
Research direction
Start with the attached module-info.java and surefireargs8788494900922906864, then compare the classpath and module-path behavior shown in the log and JVM dump. Reproduce the Java 9 modular test setup with named and automatic modules; done means dependencies are placed on the appropriate path and the JAXB access behavior matches the module declarations.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100