Skip to content

Commit c66cc77

Browse files
committed
Improve README
1 parent 5cec5db commit c66cc77

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
A maven plugin that automatically deploys code formatters as `pre-commit` git hook.
77
On commit, the hook will automatically format staged files.
88

9+
# Prerequisites
10+
11+
* Maven must run on JDK 21+
12+
913
# Automatic code format and validation activation
1014

1115
Add this to your maven project **root** pom.xml :
@@ -47,6 +51,11 @@ Add this to your maven project **root** pom.xml :
4751
</build>
4852
```
4953

54+
Add this to `.mvn/jvm.config`:
55+
```
56+
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
57+
```
58+
5059
# Manual code formatting
5160

5261
```console
@@ -97,17 +106,6 @@ The plugin allows you to tweak Google Java Format options :
97106
</build>
98107
```
99108

100-
## JDK 16+ peculiarities
101-
102-
Since google-java-format uses JDK internal apis, if you need to run the plugin with JDK 16+, you must pass some additional arguments to the JVM.
103-
Those are described at https://github.com/google/google-java-format/releases/tag/v1.10.0.
104-
105-
Thanks to https://maven.apache.org/configure.html#mvn-jvm-config-file, you should be able to pass them to `.mvn/jvm.config` as follow:
106-
107-
```
108-
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
109-
```
110-
111109
# Custom code formatter
112110

113111
Thanks to its code formatter SPI, this plugin can execute any code formatter.

0 commit comments

Comments
 (0)