当我从java8迁移到java 17时,我的单元测试失败了。
无法使java.io.OptionalDataException(布尔)可访问:模块java.base不对未命名模块“打开java.io”
当我在googled上搜索时,我发现必须添加“-- add java.base/java.io=ALL-UNNAMED”选项作为JVM的参数。
我是这样做的:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
<argLine>--add-opens java.base/java.lang=ALL-UNNAMED</argLine>
<argLine>--add-opens java.base/java.util=ALL-UNNAMED</argLine>
<argLine>--add-opens java.base/java.io=ALL-UNNAMED</argLine>
</configuration>
</plugin>但我仍然有同样的问题:(有什么帮助吗?
发布于 2022-08-09 13:06:31
对我来说,把论点组合在一条语句中是有效的:
<argLine>--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED</argLine>https://stackoverflow.com/questions/71942323
复制相似问题