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 重新编译运行即可!

  • 相关阅读:
    使用 webapi+Aspose.Cells 导出execl 功能
    自定义html滚动条样式
    vue+webapi 实现WebSocket 推送
    vue 跨层级 调用solt 传递
    关于对 asp.net mvc 异步方法的理解
    c# 反射机制
    千里之行,始于足下
    [转]浅析大数据量高并发的数据库优化
    关闭rdlc报表打印预览后,关闭客户端,抛出异常“发生了应用程序级的异常 将退出”
    深拷贝
  • 原文地址:https://www.cnblogs.com/sunchunmei/p/11414346.html
Copyright © 2011-2022 走看看