Maven搭建hadoop环境报Missing artifact jdk.tools:jdk.tools:jar:

 

 

eclipse创建maven项目后,在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>com.beijing</groupId>
  <artifactId>hadoop25</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>hadoop25</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    
    <dependency>
		<groupId>org.apache.hadoop</groupId>
		<artifactId>hadoop-common</artifactId>
		<version>2.5.2</version>
	</dependency>

	<dependency>
		<groupId>org.apache.hadoop</groupId>
		<artifactId>hadoop-client</artifactId>
		<version>2.5.2</version>
	</dependency>

  </dependencies>
</project>

 

 

此时,pom.xml报错提示为: Maven搭建hadoop环境报Missing artifact jdk.tools:jdk.tools:jar:1.7

 

原因是缺少tools.jar的依赖,tools.jar在jdk的安装目录中提供了

处理方式如下,在pom.xml中 增加jdk.tools的配置信息:

 

<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.beijing</groupId>
  <artifactId>hadoop25</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>hadoop25</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    
    <dependency>
		<groupId>org.apache.hadoop</groupId>
		<artifactId>hadoop-common</artifactId>
		<version>2.5.2</version>
	</dependency>

	<dependency>
		<groupId>org.apache.hadoop</groupId>
		<artifactId>hadoop-client</artifactId>
		<version>2.5.2</version>
	</dependency>
	
	<dependency>  
	    <groupId>jdk.tools</groupId>  
	    <artifactId>jdk.tools</artifactId>  
	    <version>1.7</version>  
	    <scope>system</scope>  
	    <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>  
	</dependency>  

  </dependencies>
</project>

 

即可

 

 

 

 

 

 

你可能感兴趣的:(Maven搭建hadoop环境报Missing artifact jdk.tools:jdk.tools:jar:)