错误信息如下:

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

maven项目bulid失败_No compiler is provided in this environment.的更多相关文章

  1. maven打包错误:No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

    [INFO] Scanning for projects...[INFO]                                                                ...

  2. Maven错误:[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?的解决方法

    错误: [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather tha ...

  3. maven install 报错 No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

    1.控制台打印信息 [INFO] Scanning for projects... [INFO] [INFO] ---------------------< org.cqupt.mauger:R ...

  4. maven启动报错No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

    [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building th ...

  5. maven打包时出现no compiler is provided in this environment

    我是使用maven打jar包时出现的问题,与我问题不同的可以查看下面链接是否有棒状 http://blog.csdn.net/lslk9898/article/details/73836745 可以确 ...

  6. Maven构建项目出现No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

    No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 你应该 ...

  7. 关于Maven项目build时出现No compiler is provided in this environment的处理

    版权声明:本文为博主原创文章,未经博主允许不得转载. http://blog.csdn.net/lslk9898/article/details/73836745 近日有同事遇到在编译Maven项目时 ...

  8. 关于Maven项目build时出现No compiler is provided in this environment的处理(转)

    本文转自https://blog.csdn.net/lslk9898/article/details/73836745 近日有同事遇到在编译Maven项目时出现[ERROR] No compiler ...

  9. 关于Maven项目install时出现No compiler is provided in this environment的处理

    关于Maven项目build时出现No compiler is provided in this environment的处理 新配置的Eclipse环境,运行现有项目没问题,一日,从svn上检出了一 ...

随机推荐

  1. [Nowcoder113E]弹球弹弹弹_线段树

    弹球弹弹弹 题目大意:有n个位置,标号为1到n的整数,m次操作,第i次操作放置一个弹球在b[i] xor c[i-1]处,并询问b[i] xor c[i-1]处弹球个数c[i]每次操作后,在x处的弹球 ...

  2. Django模块

    django.contrib.humanize 一系列Django的模板过滤器,有助于向数据添加“人文关怀”. 把'django.contrib.humanize'添加到INSTALLED_APPS设 ...

  3. 【转帖】K8s-yaml的使用及命令

    K8s-yaml的使用及命令 https://www.cnblogs.com/fuyuteng/p/9460534.html YAML配置文件管理对象 对象管理: # 创建deployment资源 k ...

  4. Kick Start 2019 Round H. Elevanagram

    设共有 $N = \sum_{i=1}^{9} A_i$ 个数字.先把 $N$ 个数字任意分成两组 $A$ 和 $B$,$A$ 中有 $N_A = \floor{N/2}$ 个数字,$B$ 中有 $N ...

  5. position: sticky 防坑指南

    position: sticky 防坑指南:https://www.jianshu.com/p/e217905e8b87 今天在写小程序项目的时候碰到一个需求是要把轮播图下面的标签栏滑动到顶部后固定, ...

  6. JZOJ.1002【USACO题库】1.1.3 Friday the Thirteenth黑色星期五

    每日一博第一天! 保持你的决心 题目描述 13号又是星期五是一个不寻常的日子吗? 13号在星期五比在其他日少吗?为了回答这个问题,写一个程序来计算在n年里13 日落在星期一,星期二......星期日的 ...

  7. JS的精确简单的加减乘除

    简单的写法: <script> function decNum(a){/*获取小数位数*/ var r=0; a=a.toString(); if(a.indexOf(".&qu ...

  8. F. 汤圆防漏理论

    ghc很喜欢吃汤圆,但是汤圆很容易被粘(zhān)漏. 根据多年吃汤圆经验,ghc总结出了一套汤圆防漏理论: 互相接触的汤圆容易粘(zhān)在一起,并且接触面积不同,粘(zhān)在一起的粘(niá ...

  9. python + Pyglet ---播放视频

    记得安装pyglet 包,AVbin(http://avbin.github.io/AVbin/Download.html) 参考链接: Pyglet教程 http://www.hawstein.co ...

  10. Neo4j WARNING: Max 1024 open files allowed, minimum of 40 000 recommended. See the Neo4j manual

    you can add a line in /etc/default/neo4j: NEO4J_ULIMIT_NOFILE=60000 to set the ulimit setting (60000 ...