Skip to content

Commit

Permalink
Added documentation for Java 17 (#496)
Browse files Browse the repository at this point in the history
For dealing with illegal access error.
  • Loading branch information
freemanjp committed Aug 21, 2022
1 parent d728ba4 commit f76702c
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/maven-build.yml
Expand Up @@ -5,6 +5,7 @@ env:
JAVA_TOOL_OPTIONS: >-
-XX:TieredStopAtLevel=1
-XX:+UseParallelGC
--illegal-access=deny
jobs:
build:
Expand Down
1 change: 1 addition & 0 deletions .mvn/jvm.config
@@ -0,0 +1 @@
--add-opens java.base/java.lang=ALL-UNNAMED
21 changes: 21 additions & 0 deletions README.md
Expand Up @@ -9,6 +9,27 @@ This plugin provides the ability to use
[ktlint](https://github.com/pinterest/ktlint) to format and check your source
code against the ktlint anti-bikeshedding code style.

## Using Java 17 and later

Java 17 is the first LTS release to enforce strong encapsulation. For `ktlint`
to work we need to add `--add-opens java.base/java.lang=ALL-UNNAMED` to the JVM
arguments.

We recommend that you add a `.mvn/jvm.config` file (relative to the top level
project directory) to all of your projects using this plugin. The file should
have the following contents:

```
--add-opens java.base/java.lang=ALL-UNNAMED
```

We also recommend adding this to all of your projects using this plugin and
building with Java 11, as it'll suppress an illegal-access warning during the
build.

For other options see:
[https://maven.apache.org/configure.html](https://maven.apache.org/configure.html)

## Goals Overview

* [ktlint:format](http://gantsign.com/ktlint-maven-plugin/format-mojo.html)
Expand Down
1 change: 1 addition & 0 deletions src/it/check/.mvn/jvm.config
@@ -0,0 +1 @@
--add-opens java.base/java.lang=ALL-UNNAMED
1 change: 1 addition & 0 deletions src/it/checkstyle/.mvn/jvm.config
@@ -0,0 +1 @@
--add-opens java.base/java.lang=ALL-UNNAMED
1 change: 1 addition & 0 deletions src/it/format/.mvn/jvm.config
@@ -0,0 +1 @@
--add-opens java.base/java.lang=ALL-UNNAMED
1 change: 1 addition & 0 deletions src/it/report/.mvn/jvm.config
@@ -0,0 +1 @@
--add-opens java.base/java.lang=ALL-UNNAMED

0 comments on commit f76702c

Please sign in to comment.