You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Michael Osipov (Jira)" <ji...@apache.org> on 2022/04/04 09:58:00 UTC
[jira] [Closed] (SUREFIRE-2053) .mvn/jvm.config not passed to surefire (--add-opens)
[ https://issues.apache.org/jira/browse/SUREFIRE-2053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Osipov closed SUREFIRE-2053.
------------------------------------
Resolution: Information Provided
> .mvn/jvm.config not passed to surefire (--add-opens)
> ----------------------------------------------------
>
> Key: SUREFIRE-2053
> URL: https://issues.apache.org/jira/browse/SUREFIRE-2053
> Project: Maven Surefire
> Issue Type: Bug
> Reporter: Marc Schlegel
> Priority: Major
>
> We are on the way upgrading to Java 17 and since 17 does not allow unopened access anymore we have to pass several add-open JVM settings.
> Following [this|https://maven.apache.org/configure.html] documentation, we've setup the needed instructions.
> {code:java}
> --add-opens java.base/java.lang=ALL-UNNAMED
> --add-opens java.base/sun.nio.ch=ALL-UNNAMED
> --add-opens java.base/java.io=ALL-UNNAMED
> --add-opens java.base/java.time=ALL-UNNAMED
> {code}
> We currently see two cases where add-opens is needed:
> * jqassistant-plugin
> * OpenPojo Library during test-phase
> The jqassistant-plugin works fine with this settings (and fails without), though the surefire-plugin is not passing the jvm-options (or maven-core is not passing it to surefire).
> This is the error which OpenPojo receives:
> {code:java}
> Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private static final long java.time.LocalDate.serialVersionUID accessible: module java.base does not "opens java.time" to unnamed module @48a242ce {code}
> As a workaround I have to configure surefire via argLine in addition to jvm.options
> {code:java}
> <plugin>
> <artifactId>maven-surefire-plugin</artifactId>
> <version>${maven-surefire-plugin.version}</version>
> <configuration>
> <argLine>
> --add-opens java.base/java.time=ALL-UNNAMED
> </argLine>
> <skipTests>${skipUTs}</skipTests>
> <systemProperties>
> <java.util.logging.manager>
> org.jboss.logmanager.LogManager
> </java.util.logging.manager>
> </systemProperties>
> <includes>
> <include>**/*Test.java</include>
> <include>**/*Spec.java</include>
> </includes>
> </configuration>
> </plugin> {code}
> This should not be necessary. It should be enough to configure jvm specific settings for Maven in one place.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)