Skip to content

Commit f9be2ae

Browse files
committed
[Java17] Add --add-export settings to restore JDK17 compatibility
After #13700 updated google-java-format dependency, it is now required to add a number of `--add-export` flags in order to run on JDK17. This commit adds these flags to the jvm options for a running logstash, and to the tests running on gradle to enable tests to still work
1 parent 187acc8 commit f9be2ae

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

build.gradle

+8-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ allprojects {
8383

8484
//https://stackoverflow.com/questions/3963708/gradle-how-to-display-test-results-in-the-console-in-real-time
8585
tasks.withType(Test) {
86+
jvmArgs = [
87+
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
88+
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
89+
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
90+
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
91+
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"
92+
]
8693
testLogging {
8794
// set options for log level LIFECYCLE
8895
events "passed", "skipped", "failed", "standardOut"
@@ -893,4 +900,4 @@ if (System.getenv('OSS') != 'true') {
893900
tasks.register("runXPackIntegrationTests"){
894901
dependsOn copyPluginTestAlias
895902
dependsOn ":logstash-xpack:rubyIntegrationTests"
896-
}
903+
}

config/jvm.options

+6
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@
7373
# Copy the logging context from parent threads to children
7474
-Dlog4j2.isThreadContextMapInheritable=true
7575

76+
11-:--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
77+
11-:--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
78+
11-:--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
79+
11-:--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
80+
11-:--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
81+
7682
11-:--add-opens=java.base/java.security=ALL-UNNAMED
7783
11-:--add-opens=java.base/java.io=ALL-UNNAMED
7884
11-:--add-opens=java.base/java.nio.channels=ALL-UNNAMED

0 commit comments

Comments
 (0)