Skip to content

Commit

Permalink
[Java17] Add --add-export settings to restore JDK17 compatibility
Browse files Browse the repository at this point in the history
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
  • Loading branch information
robbavey committed Mar 24, 2022
1 parent 8c3e7a9 commit 08aa167
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 8 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ allprojects {

//https://stackoverflow.com/questions/3963708/gradle-how-to-display-test-results-in-the-console-in-real-time
tasks.withType(Test) {
jvmArgs = [
"--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"
]
testLogging {
// set options for log level LIFECYCLE
events "passed", "skipped", "failed", "standardOut"
Expand Down Expand Up @@ -893,4 +900,4 @@ if (System.getenv('OSS') != 'true') {
tasks.register("runXPackIntegrationTests"){
dependsOn copyPluginTestAlias
dependsOn ":logstash-xpack:rubyIntegrationTests"
}
}
6 changes: 6 additions & 0 deletions config/jvm.options
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@
# Copy the logging context from parent threads to children
-Dlog4j2.isThreadContextMapInheritable=true

11-:--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
11-:--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
11-:--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
11-:--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
11-:--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED

11-:--add-opens=java.base/java.security=ALL-UNNAMED
11-:--add-opens=java.base/java.io=ALL-UNNAMED
11-:--add-opens=java.base/java.nio.channels=ALL-UNNAMED
Expand Down

0 comments on commit 08aa167

Please sign in to comment.