我想从hadoop的书中构建示例项目,但是我得到了“无法解析依赖项错误”。以下是生成过程中的错误:
[INFO] Building Chapter 2: MapReduce 3.0
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.apache.hadoop:hadoop-core:jar:0.23.10 is missing, no dependency information available
[WARNING] The POM for org.apache.hadoop:hadoop-test:jar:0.23.10 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Chapter 2: MapReduce .............................. FAILURE [1.409s]
[INFO] Hadoop: The Definitive Guide, Example Code ........ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.819s
[INFO] Finished at: Wed May 14 12:19:14 EEST 2014
[INFO] Final Memory: 6M/67M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project ch02: Could not resolve dependencies for project com.hadoopbook:ch02:jar:3.0: The following artifacts could not be resolved: org.apache.hadoop:hadoop-core:jar:0.23.10, org.apache.hadoop:hadoop-test:jar:0.23.10: Failure to find org.apache.hadoop:hadoop-core:jar:0.23.10 in https://repository.apache.org/content/repositories/releases/ was cached in the local repository, resolution will not be reattempted until the update interval of apache.releases has elapsed or updates are forced -> [Help 1]
这是我的pom.xml for ch02项目
<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>
<parent>
<groupId>com.hadoopbook</groupId>
<artifactId>hadoop-meta</artifactId>
<version>3.0</version>
<relativePath>../hadoop-meta/pom.xml</relativePath>
</parent>
<groupId>com.hadoopbook</groupId>
<artifactId>ch02</artifactId>
<packaging>jar</packaging>
<version>3.0</version>
<name>Chapter 2: MapReduce</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
</dependency>
</dependencies>
</project>
你知道我如何用maven构建这个代码吗?问题是什么?谢谢
2条答案
按热度按时间8zzbczxx1#
现在的情况是,maven在远程存储库中找不到它要找的东西。因此,当它接触到apache的maven存储库时,它只是没有找到版本0.23.10 hadoop测试的资源。
尤其是问题中pom文件的第8行
<relativePath>../hadoop-meta/pom.xml</relativePath>
是指导maven看hadoop-meta/pom.xml
. 在第48行到第50行,您将看到hadoop测试库的规范:那个
${hadoop.version}
是在maven命令中指定的值,即0.23.10
. 于是maven去了ApacheRepo,寻找hadoop测试v0.23.10,它并不存在。于是Maven摔倒了。现在,如果您使用了hadoop测试中存在的版本,或者更改了pom文件,使hadoop测试不再是依赖项。
uqdfh47h2#
我也遇到了这个问题,原来是因为netbeans在pom.xml文件中添加了一些东西。再次检查自上次成功部署以来未添加任何内容。