File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed
Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change 66A maven plugin that automatically deploys code formatters as ` pre-commit ` git hook.
77On 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
1115Add 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
113111Thanks to its code formatter SPI, this plugin can execute any code formatter.
You can’t perform that action at this time.
0 commit comments