我是hadoop新手。最近我正在开发hadoop2.6.0(yarn)。现在,我想学习一个简单的Yarn应用程序。我发现了这个简单的Yarn应用程序。但遗憾的是,当我跑的时候 mvn package
,它显示如下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project simple-yarn-app: Compilation failure: Compilation failure:
[ERROR] /home/user/simple-yarn-app/src/main/java/com/hortonworks/simpleyarnapp/ApplicationMaster.java:[30,14] error: generics are not supported in -source 1.3
[ERROR]
[ERROR] (use -source 5 or higher to enable generics)
[ERROR] /home/user/simple-yarn-app/src/main/java/com/hortonworks/simpleyarnapp/ApplicationMaster.java:[64,33] error: enhanced for loops are not supported in -source 1.3
[ERROR]
[ERROR] (use -source 5 or higher to enable for-each loops)
[ERROR] /home/user/simple-yarn-app/src/main/java/com/hortonworks/simpleyarnapp/Client.java:[72,7] error: generics are not supported in -source 1.3
[ERROR]
[ERROR] (use -source 5 or higher to enable generics)
[ERROR] /home/user/simple-yarn-app/src/main/java/com/hortonworks/simpleyarnapp/Client.java:[121,18] error: enhanced for loops are not supported in -source 1.3
[ERROR]
[ERROR] (use -source 5 or higher to enable for-each loops)
[ERROR] /home/user/simple-yarn-app/src/main/java/com/hortonworks/simpleyarnapp/ApplicationMasterAsync.java:[35,42] error: generics are not supported in -source 1.3
[ERROR]
[ERROR] (use -source 5 or higher to enable generics)
[ERROR] /home/user/simple-yarn-app/src/main/java/com/hortonworks/simpleyarnapp/ApplicationMasterAsync.java:[36,33] error: enhanced for loops are not supported in -source 1.3
我的mvn版本是:
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.8.0_31, vendor: Oracle Corporation
Java home: /usr/lib/jvm/jdk1.8.0_31/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-45-generic", arch: "amd64", family: "unix"
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.hortonworks</groupId>
<artifactId>simple-yarn-app</artifactId>
<version>1.1.0</version>
<name>simple-yarn-app</name>
<url>https://github.com/hortonworks/simple-yarn-app</url>
<dependencies>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-client</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>2.6.0</version>
</dependency>
</dependencies>
</project>
我怎样才能解决这个问题?
1条答案
按热度按时间w8biq8rn1#
最后,我找到了解决办法。构建错误是由于maven泛型引起的,这是google搜索中的一个热门问题。您需要将此添加到pom.xml中:
这里有一个链接:maven泛型
谢谢您!