You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Marc Schlegel (Jira)" <ji...@apache.org> on 2022/04/01 13:26:00 UTC
[jira] [Updated] (MNG-7450) .mvn/jvm.config not passed to surefire (--add-opens)
[ https://issues.apache.org/jira/browse/MNG-7450?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marc Schlegel updated MNG-7450:
-------------------------------
Description:
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.
was:
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).
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.
> .mvn/jvm.config not passed to surefire (--add-opens)
> ----------------------------------------------------
>
> Key: MNG-7450
> URL: https://issues.apache.org/jira/browse/MNG-7450
> Project: Maven
> Issue Type: Bug
> Components: Bootstrap & Build
> Affects Versions: 3.8.3
> 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)