[英]Environment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module
I want to using GraalVM in my Spring Boot 2.3.10.RELEASE project because it can decrease the memory usage of JVM(Now I am using JDK 11), so I add the dependencies:我想在我的 Spring Boot 2.3.10.RELEASE 项目中使用 GraalVM,因为它可以减少 JVM 的内存使用量(现在我使用的是 JDK 11),所以我添加了依赖项:
api "org.springframework.experimental:spring-native:0.10.2"
add the gradle plugin:添加 gradle 插件:
apply plugin: "com.github.ayltai.spring-graalvm-native-plugin"
add native build config:添加原生构建配置:
nativeImage {
mainClassName = 'com.dolphin.soa.manage.AppStarter'
traceClassInitialization = true
reportExceptionStackTraces = true
removeUnusedAutoConfig = true
removeYamlSupport = true
removeSpelSupport = true
removeJmxSupport = true
maxHeapSize = '4G'
}
finnaly I am using this Gradle(7.0) command to build a native jar:最后我正在使用这个 Gradle(7.0) 命令来构建一个原生 jar:
./gradlew clean :dolphin-manage:dolphin-manage-service:bootBuildImage -x test
but show this error:但显示此错误:
> Configure project :dolphin-acientbay
/Users/dolphin/source/retire
> Configure project :dolphin-post
/Users/dolphin/source/retire
> Configure project :dolphin-template
/Users/dolphin/source/retire
> Task :dolphin-common:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dolphin-common:compileJava'.
> java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module @0x2155f75f) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x2155f75f
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 6m 49s
5 actionable tasks: 1 executed, 4 up-to-date
(base)
is it a compatible problem about GraalVM and lombok?这是关于 GraalVM 和 lombok 的兼容问题吗? is it possible to fix it?有可能修复它吗?
I'm seeing this same type of error running spotless on my Java project.我在我的 Java 项目中看到同样类型的错误运行得一尘不染。 I just reported a bug about this to them: https://github.com/diffplug/spotless/issues/1244我刚刚向他们报告了一个关于此的错误: https ://github.com/diffplug/spotless/issues/1244
I diagnosed the problem as some kind behavioral change between Java 15 and Java 16. So one thing you can do is revert to an earlier version of Java to see if that makes the issue go away.我将问题诊断为 Java 15 和 Java 16 之间的某种行为变化。因此,您可以做的一件事是恢复到 Java 的早期版本,看看这是否会使问题消失。 If it does, you should report a bug similar to what I did to the project with the problem so they can try to fix it.如果是这样,您应该报告一个类似于我对有问题的项目所做的错误,以便他们可以尝试修复它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.