错误记录Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-co...

在IDEA Terminal终端运行$ mvn clean package -Dmaven.test.skip=true进行清除编译文件时报错。

[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.367 s
[INFO] Finished at: 2020-03-09T11:49:57+08:00
[INFO] Final Memory: 10M/184M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project m
aven_pro1: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR]
[ERROR] -> [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/MojoFailureException

解决思路

1、 检查pom.xml文件中关于maven编译插件的版本信息


         org.apache.maven.plugins
         maven-compiler-plugin
         
           1.7
           1.7
           UTF-8
           
             ${project.basedir}/src/main/webapp/WEB-INF/lib
           
         

发现版本信息需要完善,完善后如下:


          org.apache.maven.plugins
          maven-compiler-plugin
         
          
            1.8
            1.8
           true
          
            E:\software\jdk1.8\bin\javac
            UTF-8
            
              ${project.basedir}/src/main/webapp/WEB-INF/lib
            
          
        

2、检查IDEA系统配置jdk版本

1.png
2.png

3、再次执行命令$ mvn clean package -Dmaven.test.skip=true

3.png

你可能感兴趣的:(错误记录Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-co...)