问题描述
我正在尝试导入 cloudera 的 org.apache.hadoop:hadoop-client:2.0.0-cdh4.0.0 from cdh4 maven repo in a maven project in eclipse 3.81, m2e plugin, with oracle's jdk 1.7.0_05 on win7 using
I am trying to import cloudera's org.apache.hadoop:hadoop-client:2.0.0-cdh4.0.0 from cdh4 maven repo in a maven project in eclipse 3.81, m2e plugin, with oracle's jdk 1.7.0_05 on win7 using
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.0.0-cdh4.0.0</version>
</dependency>
但是,我收到以下错误:
however, I get the following error:
The container 'Maven Dependencies' references non existing library 'C:UsersMyUserId.m2
epositoryjdk oolsjdk.tools1.6jdk.tools-1.6.jar'
更具体地说,maven 声明缺少以下工件
more specific, maven states that the following artifact is missing
Missing artifact jdk.tools:jdk.tools:jar:1.6
如何解决这个问题?
推荐答案
jdk.tools:jdk.tools
(或 com.sun:tools
,或任何你命名的it) 是一个与 JDK 一起分发的 JAR 文件.通常你将它添加到 Maven 项目中,如下所示:
jdk.tools:jdk.tools
(or com.sun:tools
, or whatever you name it) is a JAR file that is distributed with JDK. Usually you add it to maven projects like this:
<dependency>
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
请参阅 Maven 常见问题解答,用于将依赖项添加到 tools.jar
一个>
或者,您可以使用以下方法在本地存储库中手动安装 tools.jar
:
Or, you can manually install tools.jar
in the local repository using:
mvn install:install-file -DgroupId=jdk.tools -DartifactId=jdk.tools -Dpackaging=jar -Dversion=1.6 -Dfile=tools.jar -DgeneratePom=true
然后像 Cloudera 一样引用它,使用:
and then reference it like Cloudera did, using:
<dependency>
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
<version>1.6</version>
</dependency>
这篇关于使用 Eclipse/Maven 构建 Hadoop - 缺少工件 jdk.tools:jdk.tools:jar:1.6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!