不再支持错误“源选项5".使用6或更高版本"在Maven上编译 [英] Error "Source option 5 is no longer supported. Use 6 or later" on Maven compile

查看:124
本文介绍了不再支持错误“源选项5".使用6或更高版本"在Maven上编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到以下错误或$ mvn编译:

I am getting the following error or $ mvn compile:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Sym360: Compilation failure: Compilation failure: 
[ERROR] Source option 5 is no longer supported. Use 6 or later.
[ERROR] Target option 1.5 is no longer supported. Use 1.6 or later.
[ERROR] -> [Help 1]

这是我的pom.xml的代码:

Here is the code of my 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/maven-v4_0_0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <groupId>com.test.app</groupId>
 <artifactId>Tset</artifactId>
 <packaging>jar</packaging>
 <version>1.0-SNAPSHOT</version>
 <name>Test</name>
 <url>http://maven.apache.org</url>

 <properties>
   <maven.compiler.source>6</maven.compiler.source>
   <maven.compiler.target>1.6</maven.compiler.target>
 </properties>

<build>
<pluginManagement>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.22.1</version>
    </plugin>
  </plugins>
</pluginManagement>
</build>
<dependencies>

<!-https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium- 
java -->
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.14.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>6.14.3</version>
    <scope>test</scope>
</dependency>

我试图在pom.xml代码中添加属性,但是仍然遇到相同的错误.有人可以帮助我解决这个问题吗?预先感谢

I tried to add properties in the pom.xml code, but still getting the same error. Can someone help me in resolving this issue? Thanks in advance

推荐答案

这对我有帮助:

  1. 右键单击项目.
  2. 单击构建路径.
  3. 单击配置构建路径".
  4. 它会打开一个Java构建路径窗口.
  5. 单击左侧的Java编译器.
  6. 它导航到Java Compiler窗口,根据您的jre版本(如Java版本为1.8,则设置Compiler遵从性级别)进行设置然后选择1.8)作为选择.
  7. 单击[应用]按钮.
  8. 单击[确定]按钮.
  9. 右键单击项目">"Maven">更新项目".
  10. 右键单击项目">运行方式"> Maven安装-pom.xml文件正在运行,并且将Java jar下载并安装到项目中.
  11. 右键单击项目>运行方式> Maven测试-pom.xml文件正在运行,并且将Java jar下载并安装到项目中.

然后您会收到Build Success消息,并且您的maven项目已成功创建.

Then you got the Build Success message and your maven project is created successfully.

这篇关于不再支持错误“源选项5".使用6或更高版本"在Maven上编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆