我在$ 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
代码
<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
代码中添加属性,但仍然得到了相同的错误。
发布于 2018-10-28 19:55:33
这帮了我:
然后,您得到了构建成功消息,并且成功创建了maven项目。
发布于 2020-05-21 18:51:23
帮助我的是pom.xml文件中的这些行
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
发布于 2020-02-11 16:04:36
我也有同样的问题,问题是财产问题。检查项目中的JavaSE版本,它将显示在项目中的文件夹旁边。如果是1.5,则会抛出一个错误。很可能您将有一个更新的版本,所以检查版本并更新它。我已经根据您的代码更新了下面的内容。
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
https://stackoverflow.com/questions/53034953
复制相似问题