Java 项目编译错误 Error:java: java.lang.ExceptionInInitializer

错误提示信息为:java

Error:java: java.lang.ExceptionInInitializerError 
    com.sun.tools.javac.code.TypeTags

compile-type-error-01.jpg

若是使用 Maven 错误信息是同样的。apache

\[INFO\] ------------------------------------------------------------------------
\[INFO\] BUILD FAILURE
\[INFO\] ------------------------------------------------------------------------
\[INFO\] Total time:  2.449 s
\[INFO\] Finished at: 2020-02-26T08:34:45-05:00
\[INFO\] ------------------------------------------------------------------------
\[ERROR\] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project core-java-annotations: Fatal error compiling: java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTags -> \[Help 1\]
\[ERROR\]
\[ERROR\] To see the full stack trace of the errors, re-run Maven with the -e switch.
\[ERROR\] Re-run Maven using the -X switch to enable full debug logging.
\[ERROR\]
\[ERROR\] For more information about the errors and possible solutions, please read the following articles:
\[ERROR\] \[Help 1\] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

compile-type-error-02.jpg

请问这是什么缘由呢?maven

这个可能缘由是你编译器的环境使用太高。可是你的依赖ide

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.6.12</version>
    <scope>provided</scope>
</dependency>

太低致使的。spa

能够解决的办法是将你的编译 JDK 降到 1.8。debug

或者将 org.projectlombok 升级到最新的版本。code

例如咱们在 IntelliJ 中,使用 1.8 编译代码,就没有错误。orm

compile-type-error-03.jpg

https://www.cwiki.us/display/...blog

相关文章
相关标签/搜索