[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project ProjectName: Fatal error compiling: CompilerException: NullPointerException -> [Help 1]

原因:代码编译出错被掩盖了


The underlying problem is usually caused by a compiler error that gets masked. To find out the compiler error,
pass -Dmaven.compiler.forceJavacCompilerUse=true to the mvn command line.
After fixing the compiler error, the problem goes away.

在pom里增加<forceJavacCompilerUse>true</forceJavacCompilerUse> 找出错误原因,修改后再编译

 

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
</configuration>
</plugin>
</plugins>
</build>

  

posted on 2022-06-02 09:21  sidesky  阅读(494)  评论(0编辑  收藏  举报