hadoop eclipse插件生成错误

x8goxv8g  于 2021-06-03  发布在  Hadoop
关注(0)|答案(1)|浏览(357)

我已经安装了hadoop1.1.2,并按照中描述的步骤构建了eclipse插件http://surajit-paul.blogspot.com/p/eclipse-configuration-for-hadoop-112.html 但是当我想构建插件,运行 ant 命令,我得到一个很长的错误列表 [javac] 100 errors :

ivy-retrieve-common:
[ivy:retrieve] :: retrieving :: org.apache.hadoop#eclipse-plugin [sync]
[ivy:retrieve]  confs: [common]
[ivy:retrieve]  0 artifacts copied, 2 already retrieved (0kB/5ms)
[ivy:cachepath] DEPRECATED: 'ivy.conf.file' is deprecated, use 'ivy.settings.file' instead
[ivy:cachepath] :: loading settings :: file = /Users/majid/Desktop/hadoop-1.1.2/ivy/ivysettings.xml

compile:
 [echo] contrib: eclipse-plugin
[javac] /Users/majid/Desktop/hadoop-1.1.2/src/contrib/eclipse-plugin/build.xml:61: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 45 source files to /Users/majid/Desktop/hadoop-1.1.2/build/contrib/eclipse-plugin/classes
[javac] /Users/majid/Desktop/hadoop-1.1.2/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFolder.java:28: package org.apache.hadoop.fs does not exist
[javac] import org.apache.hadoop.fs.FileStatus;
[javac]                            ^
[javac] /Users/majid/Desktop/hadoop-1.1.2/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFolder.java:29: package org.apache.hadoop.fs does not exist
[javac] import org.apache.hadoop.fs.Path;
[javac]                            ^
[javac] /Users/majid/Desktop/hadoop-1.1.2/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java:25: package org.apache.hadoop.hdfs does not exist
[javac] import org.apache.hadoop.hdfs.DistributedFileSystem;
[javac]                              ^
[javac] /Users/majid/Desktop/hadoop-1.1.2/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java:29: package org.apache.hadoop.fs does not exist
[javac] import org.apache.hadoop.fs.FileSystem;
[javac]                            ^
[javac] /Users/majid/Desktop/hadoop-1.1.2/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java:30: package org.apache.hadoop.fs does not exist
[javac] import org.apache.hadoop.fs.Path;
[javac]                            ^
[javac] /Users/majid/Desktop/hadoop-1.1.2/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:36: package org.apache.hadoop.conf does not exist
[javac] import org.apache.hadoop.conf.Configuration;
[javac]                              ^
[javac] /Users/majid/Desktop/hadoop-1.1.2/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:38: package org.apache.hadoop.fs does not exist
[javac] import org.apache.hadoop.fs.FileSystem;
[javac]                            ^
[javac] /Users/majid/Desktop/hadoop-1.1.2/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:39: package org.apache.hadoop.io does not exist
[javac] import org.apache.hadoop.io.IOUtils;
[javac]                            ^
[javac] /Users/majid/Desktop/hadoop-1.1.2/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:40: package org.apache.hadoop.mapred does not exist
[javac] import org.apache.hadoop.mapred.JobClient;
[javac]                                ^
.
.
.
.
.
[javac] /Users/majid/Desktop/hadoop-1.1.2/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:302: package Counters does not exist
[javac]       Counters.Group group = counters.getGroup(groupName);
[javac]               ^
[javac] Note: /Users/majid/Desktop/hadoop-1.1.2/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/JarModule.java uses or overrides a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 100 errors

我到处找了很多,但都没变。我是新来的 ant 或者其他类似的东西。如果有人能帮我,我真的很感激,或者如果你已经有了hadoop-eclipse-1.1.2.jar插件,请上传它。

mjqavswn

mjqavswn1#

您需要包含所有hadoop依赖项。在编译hadoop程序时,它使用hadoop类,为了确保编译器能够看到那些hadoop类,您需要告诉它所有hadoop jar的位置。
下面是一个如何修改 build.xml 使用ant设置类路径,但是您必须添加到完整的列表中。完整的列表是您在eclipse中包含的所有jar,包括您在库中添加的所有jar。

<property name="src" location="my/src/path" />
<property name="bin" location="my/bin/directory" />
<property name="lib" location="/path/to/hadoop/libs/" />
<target name="build" depends="init" description="compiling my hadoop program source">
    <javac srcdir="${src}" destdir="${bin}" debug="on" debuglevel="lines,vars,source" includeantruntime="false" encoding="Cp1252">
        <classpath>
            <pathelement path="${lib}" />
            <pathelement location="${lib}/hadoop-mapreduce-client-core-*.jar" />
            <pathelement location="${lib}/hadoop-mapreduce-client-common-*.jar" />
            ...
            <pathelement location="${lib}/some-other-jar.jar" />
        </classpath>
    </javac>
</target>

相关问题