Error recurrence
I installed maven 3.5.0 on my machine and created a maven project in eclipse. Pom.xml is configured as follows:
<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>
Right click the project – > Maven -> Update Project … -> The OK code always gives error prompts, which are as follows: lambda expressions are allowed only at source level 1.8 or above
Solutions
To change the pom.xml configuration, there are two key statements:
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target>
Add these two statements to the properties tag pair, and the changed code is as follows:
<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>
Right click the project again – > Maven -> Update Project … -> OK 。
if update project doesn’t work, right-click – > Run as -> Maven build… -> In goals, enter clean compile – > RUN
There should be no error prompts at this time
Similar Posts:
- Maven [error] no longer supports source option 5. Please use version 7 or later
- Unregistering JMX-exposed beans on shutdown Solution
- Springboot always reports an error when importing JSP dependencies
- Eureka server project startup error handling
- Maven no main manifest attribute when generate jar for project
- [Solved] Error attempting to get column ‘create_time‘ from result set. Cause: java.sql.SQLFeatureNotSupported
- Maven warnning: ‘build.plugins.plugin.version’ is missing [How to Solve]
- [Solved] Dynamic Web Module 3.0 requires Java 1.6 or newer
- Dynamic Web Module 3.1 requires Java 1.7 or newer
- [Solved] Error:java: Compilation failed: internal java compiler error