错误重现

我的机器上安装了 maven 3.5.0,在 eclipse 中创建 maven 项目。pom.xml配置如下:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>zhangchao</groupId>
<artifactId>testVertx</artifactId>
<version>0.0.1-SNAPSHOT</version> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties> <dependencies>
<!-- 一些依赖 -->
</dependencies>
</project>

在项目上鼠标右键 -> Maven -> Update Project … -> OK 代码中一直给出错误提示,内容如下:Lambda expressions are allowed only at source level 1.8 or above.

解决方法

更改 pom.xml 配置,有两条关键语句:

<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

把这两条语句加入 properties 标签对中,更改后的代码如下:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>zhangchao</groupId>
<artifactId>testVertx</artifactId>
<version>0.0.1-SNAPSHOT</version> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties> <dependencies>
<!-- 一些依赖 -->
</dependencies>
</project>

重新在项目上鼠标右键 -> Maven -> Update Project … -> OK 。 
如果Update Project还不管用,就鼠标右键 -> Run as -> Maven build… -> Goals 中输入 clean compile -> RUN

这个时候应该就不会有错误提示了。

【104】Maven3.5.0结合eclipse使用,提示Lambda expressions are allowed only at source level 1.8 or above错误的解决方法的更多相关文章

  1. Eclipse启动时发生An internal error occurred during: "Initializing Java Tooling".错误的解决方法

    问题描述: Eclipse启动时发生An internal error occurred during: "Initializing JavaTooling".错误的解决方法 解决 ...

  2. Jquery中使用setInterval和setTimeout会提示缺少对象的错误,解决方法如下:

    直接在ready中调用其他方法,会提示缺少对象的错误,解决方法如下: 方法1. 应用jQuery的扩展可以解决这个问题. $(document).ready(function(){ $.extend( ...

  3. 启动 Eclipse 弹出“Failed to load the JNI shared library jvm.dll”错误的解决方法!&&在eclipse.ini中为eclipse指定jdk启动

    参考:http://blog.csdn.net/zyz511919766/article/details/7442633 http://blog.sina.com.cn/s/blog_028f0c1c ...

  4. 启动 Eclipse 弹出“Failed to load the JNI shared library jvm.dll”错误的解决方法!

    启动 Eclipse 弹出"Failed to load the JNI shared library jvm.dll"错误的解决方法 http://blog.csdn.net/z ...

  5. Win8.1无法安装更新,提示0x800*****错误的解决方法

    Win8.1无法安装更新,提示0x800*****错误的解决方法   注:本教程同样适用于Win10系统 有时候Win8.1某个系统文件的损坏会导致无法安装Windows更新,表现为Windows更新 ...

  6. Linux yum提示Loaded plugins错误的解决方法

    yum是Linux软件包管理器,也叫yum源,在yum使用过程中,有时会出现Loaded plugins错误,重启无效,遇到这种情况该如何解决呢?下面就给大家介绍下Linux yum提示Loaded ...

  7. Hyper-v安装虚拟机,提示the image's hash and certificate are not allowed错误的解决方法

    本文迁移自Panda666原博客,原发布时间:2021年3月29日. Hyper-v安装虚拟机,提示the image's hash and certificate are not allowed错误 ...

  8. 关于Quartus构建nios软核以及eclipse建立c语言工程以及成功下载到FPGA芯片过程遇到的各种问题以及解决方法详解

    这不是一篇构建nios的教程,而是遇到的各种问题以及解决方法.至于构建教程,网上一大把,我推荐正点原子的FPGA教程,比较新,比较详细,通俗易懂!!! 这里以一个点亮LED灯的Nios软核为例,很明显 ...

  9. nginx提示:500 Internal Server Error错误的解决方法

    现在越来越多的站点开始用 Nginx ,("engine x") 是一个高性能的 HTTP 和反向代理服务器,也是一个 IMAP/POP3/SMTP 代理服务器. Nginx 是由 ...

随机推荐

  1. Oracle快速插入数据append

    1:用merge into 进行匹配更新和插入,2: 开启并行,提高速度3: 如果可以的话加NOLOGING 不写入日志4:如果数据有规律的话,分批次执行 1.使用marge快速插入; MERGE / ...

  2. 配置ftp服务器

    计算机管理->用户->添加用户 iis网站右键->添加ftp站点(没有此选项确认已安装及开启了ftp服务)->进行相关设置即可

  3. windows无法连接到打印机 操作失败,错误为0x00000002 解决方案

    平时使用局域网打印机没有问题,今天突然脱机了,错误号为0x00000002 服务器上打印机一切正常,别人使用也一切正常. 最后,重启了Spooler服务后搞定. 重新链接打印机,搞定!

  4. IOS UITabBarController(控制器)的子控制器

    UITabBarController的简单使用 ● UITabBarController的使用步骤 ➢ 初始化UITabBarController ➢ 设置UIWindow的rootViewContr ...

  5. 【BZOJ4300】绝世好题(位运算水题)

    点此看题面 大致题意: 给你一个序列\(a\),让你求出最长的一个子序列\(b\)满足\(b_i\&b_{i-1}!=0\). 位运算+\(DP\) 考虑设\(f_i\)表示以第\(i\)个数 ...

  6. SpringMVC+Hibernate框架快速搭建

    1.  新建Maven项目springmvc 2.   pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" ...

  7. springboot集成shiro的session污染问题

    问题起因是这样的,有两套系统,系统a和系统b.两套系统均使用shiro做的权限管理,之前部署在两台机器上.使用浏览器打开a系统后另开页签打开b系统,互不干扰都能正常使用,后因业务迁移,两套系统部署到了 ...

  8. CVE-2018-4878

    0x00前言 该漏洞影响 Flash Player 版本28.0.0.137以及之前的所有版本 0x01 poc Poc 这里只列出关键代码 public function triggeruaf() ...

  9. 重温 JSP 与 Servlet

    Java Web使用SSH框架多了,很多基础的 JSP 与 Servlet 的东西都忘记了.最近在 JSP 标签 和 Struts2 包装的 Session 对象的混合使用时弄晕了,就翻书温习下. J ...

  10. 快速下载jar包

    1, http://www.mvnrepository.com 2,可以从spring官网上下载,如果是mvn的话可以通过上面的网址下载