前言
参考 https://aisensiy.me/java-migrate-from-11-to-17
解决
Idea 配置
Gradle 配置
一种是直接在 build.gradle 添加如下代码
compileJava {
options.compilerArgs.addAll([
"-XDignore.symbol.file",
"--add-exports", "java.base/sun.security.pkcs=ALL-UNNAMED",
"--add-exports", "java.base/sun.security.util=ALL-UNNAMED",
"--add-exports", "java.base/sun.security.x509=ALL-UNNAMED",
])
}
compileTestJava {
options.compilerArgs.addAll([
"-XDignore.symbol.file",
"--add-exports", "java.base/sun.security.pkcs=ALL-UNNAMED",
"--add-exports", "java.base/sun.security.util=ALL-UNNAMED",
"--add-exports", "java.base/sun.security.x509=ALL-UNNAMED",
])
}
另外一种是创建 gradle.properties 文件
添加如下代码
org.gradle.jvmargs=--add-exports java.base/sun.security.x509=ALL-UNNAMED \
--add-exports java.base/sun.security.pkcs=ALL-UNNAMED \
--add-exports java.base/sun.security.util=ALL-UNNAMED \
--add-opens java.base/java.io=ALL-UNNAMED
评论区