[ https://issues.apache.org/jira/browse/SUREFIRE-2053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17516686#comment-17516686 ]
Michael Osipov commented on SUREFIRE-2053: ------------------------------------------ {{.mvn/jvm.config}} applies to the Maven JVM only, nothing else. It would be a clear violation of separation of concerns mixing both. [~tibordigana]. > .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)