|
1 | 1 | /* |
2 | | - * Copyright 2016-2024 DiffPlug |
| 2 | + * Copyright 2016-2025 DiffPlug |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -87,13 +87,13 @@ void gitAttributes() throws IOException { |
87 | 87 | if (Jvm.version() >= 16) { |
88 | 88 | // for GJF https://github.com/diffplug/spotless/issues/834 |
89 | 89 | setFile(".mvn/jvm.config").toContent( |
90 | | - "--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" + |
91 | | - " --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED" + |
92 | | - " --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED" + |
93 | | - " --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED" + |
94 | | - " --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" + |
95 | | - // this last line is for Detekt |
96 | | - " --add-opens java.base/java.lang=ALL-UNNAMED"); |
| 90 | + "--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" + |
| 91 | + " --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED" + |
| 92 | + " --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED" + |
| 93 | + " --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED" + |
| 94 | + " --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" + |
| 95 | + // this last line is for Detekt |
| 96 | + " --add-opens java.base/java.lang=ALL-UNNAMED"); |
97 | 97 | } |
98 | 98 | // copy the mvnw resources |
99 | 99 | copy("mvnw").setExecutable(true); |
@@ -213,9 +213,15 @@ protected void writePom(String[] executions, String[] configuration, String[] de |
213 | 213 | } |
214 | 214 |
|
215 | 215 | protected MavenRunner mavenRunner() throws IOException { |
216 | | - return MavenRunner.create() |
217 | | - .withProjectDir(rootFolder()) |
218 | | - .withRunner(runner); |
| 216 | + MavenRunner mavenRunner = MavenRunner.create() |
| 217 | + .withProjectDir(rootFolder()) |
| 218 | + .withRunner(runner); |
| 219 | + System.getProperties().forEach((key, value) -> { |
| 220 | + if (key instanceof String && ((String) key).startsWith("spotless") && value instanceof String) { |
| 221 | + mavenRunner.withSystemProperty((String) key, (String) value); |
| 222 | + } |
| 223 | + }); |
| 224 | + return mavenRunner; |
219 | 225 | } |
220 | 226 |
|
221 | 227 | private static ProcessRunner runner; |
@@ -337,8 +343,8 @@ protected static String[] formats(String... formats) { |
337 | 343 |
|
338 | 344 | protected static String[] formats(String[]... formats) { |
339 | 345 | String[] formatsArray = Arrays.stream(formats) |
340 | | - .flatMap(Arrays::stream) |
341 | | - .toArray(String[]::new); |
| 346 | + .flatMap(Arrays::stream) |
| 347 | + .toArray(String[]::new); |
342 | 348 | return formats(formatsArray); |
343 | 349 | } |
344 | 350 | } |
0 commit comments