JDK11 maven编译打包Compilation failure 问题解决

出现的问题:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project moon-prize-mgmt-core: Compilation failure

或者

     [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project utils: Compilation failure
     [ERROR] Failure executing javac, but could not parse the error:
     [ERROR] javac: 无效的目标发行版: 11
     [ERROR] 用法: javac <options> <source files>
     [ERROR] -help 用于列出可能的选项
     [ERROR] -> [Help 1]

解决方式:

一、配置:

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <release>11</release>
                </configuration>
            </plugin>

二、发现自己配置了,还是报错。

去掉 <fork>true</fork> 这个配置

热部署的话,可以使用idea 本身的配置即可

三、其他

maven 版本使用 3.6.0 即可  。3.6.3不兼容2019 idea

猜你喜欢

转载自blog.csdn.net/Qensq/article/details/115288103