美文网首页
错误记录Failed to execute goal org.a

错误记录Failed to execute goal org.a

作者: 信号传D | 来源:发表于2020-03-09 12:24 被阅读0次

    在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编译插件的版本信息

    <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-compiler-plugin</artifactId>
             <configuration>
               <source>1.7</source>
               <target>1.7</target>
               <encoding>UTF-8</encoding>
               <compilerArguments>
                 <extdirs>${project.basedir}/src/main/webapp/WEB-INF/lib</extdirs>
               </compilerArguments>
             </configuration>
    </plugin>
    

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

    <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
             <!-- <version>3.6.2</version>-->
              <configuration>
                <source>1.8</source>
                <target>1.8</target>
               <fork>true</fork>
              <!--以下javac的路径为电脑实际jdk1.8的安装路径-->
                <executable>E:\software\jdk1.8\bin\javac</executable>
                <encoding>UTF-8</encoding>
                <compilerArguments>
                  <extdirs>${project.basedir}/src/main/webapp/WEB-INF/lib</extdirs>
                </compilerArguments>
              </configuration>
            </plugin>
    

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

    1.png 2.png

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

    3.png

    相关文章

      网友评论

          本文标题:错误记录Failed to execute goal org.a

          本文链接:https://www.haomeiwen.com/subject/ocnudhtx.html