zoukankan      html  css  js  c++  java
  • maven项目bulid失败_No compiler is provided in this environment.

     错误信息如下:

    [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: 1.103 s
    [INFO] Finished at: 2019-08-26T17:41:36+08:00
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project springmvc: Compilation failure
    [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
    [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

    前提:maven项目,tomcat 7,jdk1.8

    根据错误信息提示:No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?这个环境中没有提供编译器。也许您运行的是JRE而不是JDK?

    1:首先查看 Eclipse-->Window-->preferences-->Java-->Installed JREs




    果然安装的是jre,而maven项目的运行需要一个和在setting.xml或者pom.xml指定的版本的jdk

    我的是在setting.xml配置的jdk,版本是1.8,配置如下:
    <profile>    
        <id>jdk-1.8</id>    
         <activation>    
            <activeByDefault>true</activeByDefault>    
            <jdk>1.8</jdk>    
          </activation>    
        <properties>    
            <maven.compiler.source>1.8</maven.compiler.source>    
            <maven.compiler.target>1.8</maven.compiler.target>
            <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> 
        </properties>    
    </profile>

    所以我们要配置一个指定版本的jdk,然后选中该jdk目录,同时为了防止出错,我把jre目录删除掉了

    
    
    2:项目右键-->build path-->configure build path-->java Build Path-->接着图片操作






    3.如果你是在pom.xml设置的jdk,那你还需要:项目右键-->run as -->run configurations..--> jre -->execution environment选择刚刚配置的jdk-->run



     update project 重新编译运行即可!

  • 相关阅读:
    ADO.NET 核心对象简介
    ASP.net 内置对象
    行内元素,块级元素与空元素
    ASP.net 常用服务器控件
    javaScript 基础知识
    点击超链接 唤醒企鹅添加好友代码
    使用CSS画出三角形
    NGUI实现的一套不同大小 Item 的循环滚动代码
    xlua怎么样hotfix C#中的重写方法???
    C# ---- GC中代的递增规律
  • 原文地址:https://www.cnblogs.com/sunchunmei/p/11414346.html
Copyright © 2011-2022 走看看