mrunitmaven项目导入问题

tf7tbtn2  于 2021-06-03  发布在  Hadoop
关注(0)|答案(1)|浏览(394)

我在o'really的《hadoop,权威指南第4版》一书中学习hadoop,我在尝试创建一个用于mrunit测试的maven项目时遇到了一个问题。我刚刚创建了pom.xml文件,如书中所示(只是更改了我的hadoop版本),但它不起作用,eclipse给了我很多帮助 ArtifactTransferException s。
我的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/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>TestUnitCounter</groupId>
   <artifactId>TestUnitCounter</artifactId>
   <version>4.0</version>
<properties>
   <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <hadoop.version>2.6.0</hadoop.version>
</properties>
<dependencies>
<dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-client</artifactId>
    <version>${hadoop.version}</version>
</dependency>

<!-- Unit test artifacts -->
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.11</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>org.apache.mrunit</groupId>
    <artifactId>mrunit</artifactId>
    <version>1.1.0</version>
    <classifier>hadoop2</classifier>
    <scope>test</scope>
</dependency>

<!-- Hadoop test artifact for running mini clusters -->
<dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-minicluster</artifactId>
    <version>${hadoop.version}</version>
    <scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<finalName>hadoop-examples</finalName>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
            <source>1.7</source>
            <target>1.7</target>
        </configuration>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.5</version>
        <configuration>
            <outputDirectory>${basedir}</outputDirectory>
        </configuration>
  </plugin>
</plugins>
</build>
</project>

有谁能告诉我如何解决这个问题并为此编写一个正确的pom.xml吗?
谢谢。

x6h2sr28

x6h2sr281#

您可以尝试以下步骤:
1) 使用以下命令删除所有失败的下载:
unix平台

find ~/.m2  -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;

windows平台

cd %userprofile%\.m2\repository
for /r %i in (*.lastUpdated) do del %i

2) 现在,在eclipse中右键单击您的项目并选择maven->updatedependencies(选中forceupdateofsnapshots/release复选框),确定。

相关问题