Buiding Hadoop with Eclipse / Maven - Missing artifact jdk.tools:jdk.tools:jar:1.6

后端 未结 12 1925
盖世英雄少女心
盖世英雄少女心 2020-12-12 12:56

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 o

相关标签:
12条回答
  • 2020-12-12 13:22

    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>
    

    See, the Maven FAQ for adding dependencies to 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
    

    and then reference it like Cloudera did, using:

    <dependency>
        <groupId>jdk.tools</groupId>
        <artifactId>jdk.tools</artifactId>
        <version>1.6</version>
    </dependency>
    
    0 讨论(0)
  • 2020-12-12 13:24

    maybe system install jdk package, but maybe some devel tools or plugin.

    I find this problem under opensuse env. and I install java-1_6_0-openjdk-devel

    the problem is disppeared..

    0 讨论(0)
  • 2020-12-12 13:25

    I also faced this problem because I just only installed JRE not with JDK. So , adding dependency for jdk.tools can't fix for me because tools.jar was not exist at my ${JAVA_HOME}/lib/ directory.

    Now I downloaded and installed JDK to fix it.

    0 讨论(0)
  • 2020-12-12 13:26

    try :

    mvn install:install-file -DgroupId=jdk.tools -DartifactId=jdk.tools -Dversion=1.6 -Dpackaging=jar -Dfile="C:\Program Files\Java\jdk\lib\tools.jar"

    also check : http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

    0 讨论(0)
  • 2020-12-12 13:28

    This worked for me:

        <dependency>
            <groupId>jdk.tools</groupId>
            <artifactId>jdk.tools</artifactId>
            <version>1.7.0_05</version>
            <scope>system</scope>
            <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
        </dependency>
    
    0 讨论(0)
  • 2020-12-12 13:30

    If you can live without tools.jar and it's only included as a chained dependency, you can exclude it from the offending project:

    <dependency>
        <groupId>org.apache.ambari</groupId>
        <artifactId>ambari-metrics-common</artifactId>
        <version>2.1.0.0</version>
        <exclusions>
            <exclusion>
                <artifactId>jdk.tools</artifactId>
                <groupId>jdk.tools</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    
    0 讨论(0)
提交回复
热议问题