Skip to content

Commit

Permalink
add examples of Java 11+ module exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
abyrd committed Jan 13, 2023
1 parent cc3bc17 commit 62f1ad5
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,38 @@ this article:

https://sormuras.github.io/blog/2018-09-11-testing-in-the-modular-world.html#white-box-modular-testing-with-extra-java-command-line-options

TODO: examples of adding exceptions (copy from R5 or OTP2)
In Gradle this might look like:
```Groovy
test {
useJUnitPlatform()
jvmArgs = ['--add-opens=java.base/java.io=ALL-UNNAMED',
'--add-opens=java.base/java.time=ALL-UNNAMED',
'--add-opens=java.base/java.time.zone=ALL-UNNAMED',
'--add-opens=java.base/java.lang=ALL-UNNAMED']
}
```

In Maven:
```xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<configuration>
<!-- we have to fork the JVM during tests so that the argLine is passed along -->
<forkCount>3</forkCount>
<!-- enable the restricted reflection under Java 11 so that the ObjectDiffer works
the @{argLine} part is there to allow jacoco to insert its arguments as well
-->
<argLine>
@{argLine}
-Xmx2G
-Dfile.encoding=UTF-8
--add-opens java.base/java.io=ALL-UNNAMED
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.math=ALL-UNNAMED
--add-opens java.base/java.net=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
```

0 comments on commit 62f1ad5

Please sign in to comment.