我在Cloudera存储库中找不到最新的mrunit(1.1.0)
。可用的一种是0.8.0-incubating
。以下是我的pom
:
<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>com.ma.hadoop</groupId>
<artifactId>MapReduce</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<hadoop.version>2.3.0-cdh5.1.2</hadoop.version>
<hive.version>0.12.0-cdh5.1.2</hive.version>
<mrunit.version>0.8.0-incubating</mrunit.version>
</properties>
<dependencies>
<!-- For unit testing -->
<dependency>
<groupId>org.apache.mrunit</groupId>
<artifactId>mrunit</artifactId>
<version>${mrunit.version}</version>
</dependency>
<!-- This is sufficient for all -->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>${hadoop.version}</version>
</dependency>
</dependencies>
<build>
<finalName>Mapred</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<outputDirectory>${basedir}</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>maven-hadoop</id>
<name>Hadoop Releases</name>
<url>https://repository.cloudera.com/content/repositories/releases/</url>
</repository>
<repository>
<id>cloudera-repos</id>
<name>Cloudera Repos</name>
<url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
</repository>
</repositories>
</project>
如果我将版本更改为1.1.0,则eclipse会在pom文件中的mrunit依赖项上找不到找不到的工件。
我尝试添加apache repo
<id>central</id>
<url>http://repo1.maven.org/maven2/</url>
<repository>
Eclipse在
.m2
中下载了jar,但是仍然没有找到工件。单元测试调用将无法编译。有人可以帮忙什么,与cloudera repo一起使用最新
mrunit
的安全方法是什么。谢谢,
阿米特
最佳答案
在您的mrunit
依赖声明中:
<dependency>
<groupId>org.apache.mrunit</groupId>
<artifactId>mrunit</artifactId>
<version>${mrunit.version}</version>
</dependency>
您应该添加
<classifier>hadoop2</classifier>
来阐明要使用的hadoop版本,分类器值为hadoop1或hadoop2。因此,由于您使用的是Hadoop 2.X,因此需要更改
pom.xml
的依赖关系:<dependency>
<groupId>org.apache.mrunit</groupId>
<artifactId>mrunit</artifactId>
<version>${mrunit.version}</version>
<classifier>hadoop2</classifier>
</dependency>