Maven引入Hadoop依赖报错:Missing artifact jdk.tools:jdk.tools:jar:1.6

时间:2024-01-01 14:38:15

Maven引入Hadoop依赖报错:Missing artifact jdk.tools:jdk.tools:jar:1.6

原因是缺少tools.jar的依赖,tools.jar在jdk的安装目录中提供了,所以改成如下形式解决此问题:
添加依赖

<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-core</artifactId>
<version>2.4.0</version>
<exclusions>
<exclusion>
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
</exclusion>
</exclusions>
</dependency>
########################添加一下一段代码即可#################################
<dependency>
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
<version>1.6</version>
<scope>system</scope>
<systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
</dependency>