Getting this error during tests:
class javax.crypto.JceSecurity (in unnamed module @0x45da40ad) cannot access class jdk.internal.util.StaticProperty (in module java.base) because module java.base does not export jdk.internal.util to unnamed module @0x45da40ad
I've tried creating jvm.config at the root, next to pom.xml as such
--add-modules ALL-SYSTEM
--add-opens java.base/jdk.internal.util=ALL-UNNAMED
--illegal-access=permit
That doesn't change anything. So i try to configure maven compiler plugin as such:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<fork>true</fork>
<compilerArgs>
<arg>--add-modules</arg>
<arg>ALL-SYSTEM</arg>
<arg>--add-opens</arg>
<arg>java.base/jdk.internal.util=ALL-UNNAMED</arg>
</compilerArgs>
<argLine>
--add-modules ALL-SYSTEM
--add-opens java.base/jdk.internal.util=ALL-UNNAMED
--illegal-access=permit
</argLine>
<source>${java.compiler.source}</source>
<target>${java.compiler.target}</target>
</configuration>
</plugin>
for the record i even tried it so:
<argLine>
--add-modules ALL-SYSTEM
--add-opens java.base/jdk.internal.util=ALL-UNNAMED
--illegal-access=permit
</argLine>
Nothing. Then i tried surefire plugin like so :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<forkCount>0</forkCount>
<argLine>
--add-modules ALL-SYSTEM
--add-opens java.base/jdk.internal.util=ALL-UNNAMED
--illegal-access=permit
</argLine>
<systemPropertyVariables>
<jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
</systemPropertyVariables>
</configuration>
</plugin>
Two days working on this and failing miserably. Please help. Using OpenJdk11
Thank to the other answers, it helped me to dig deeper. I managed to solve it with the following changes in pom
<properties>
<!-- Must be in pom's properties section. <sonar.jacoco.reportPaths>target/coverage.exec</sonar.jacoco.reportPaths> -->
<jacoco.version>0.7.7.201606060606</jacoco.version>
<!-- Used by surefire plugin run tests with openjdk11 -->
<argLine>--add-modules java.base --add-opens java.base/jdk.internal.util=ALL-UNNAMED --illegal-access=permit</argLine>
</properties>
.........
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.compiler.source}</source>
<target>${java.compiler.target}</target>
</configuration>
</plugin>
........
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<systemPropertyVariables>
<jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
</systemPropertyVariables>
</configuration>
</plugin>
Basically i had to put the argline in properties. Compiler doesn't seem to need it because it's not picking it up from there. But surefire does, it's reading the argline from maven's properties.