5

mrunit(1.1.0)我在Cloudera 存储库中找不到最新的。可用的是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下载了 jar,.m2但我仍然找不到工件。单元测试调用将无法编译。有人可以帮助使用最新mrunit的 cloudera repo 的安全方法是什么。

谢谢,阿米特

4

1 回答 1

10

在您的mrunit依赖声明中:

<dependency>
   <groupId>org.apache.mrunit</groupId>
   <artifactId>mrunit</artifactId>
   <version>${mrunit.version}</version>
</dependency>

您应该添加<classifier>hadoop2</classifier>明确您要使用哪个版本的hadoop,分类器值为hadoop1或hadoop2。

所以你需要改变pom.xml依赖,因为你使用Hadoop 2.X

<dependency>
    <groupId>org.apache.mrunit</groupId>
    <artifactId>mrunit</artifactId>
    <version>${mrunit.version}</version>
    <classifier>hadoop2</classifier>
</dependency>
于 2014-12-11T16:22:02.633 回答