• Hadoop学习之编译eclipse插件


       近期准备開始学习Hadoop1.2.1的源码,感觉最好的方法还是能够在运行Hadoop及hadoop作业时跟踪调试代码的实际运行情况。因为选择的IDE为eclipse,所以准备编译一下hadoop的eclipse插件,以下就直接进入正题。Hadoop的eclipse插件源码位于hadoop-1.2.1/src/contrib/eclipse-plugin/中,直接进入该文件夹,在不做不论什么改动的情况下,在命令行输入ant,运行效果例如以下:

    [hadoop@hadoop eclipse-plugin]$ ant
    Buildfile: /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/build.xml
    check-contrib:
         [echo] eclipse.home unset: skipping eclipse plugin
    init:
    ivy-download:
          [get] Getting: http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.1.0/ivy-2.1.0.jar
          [get] To: /home/hadoop/hadoop-1.2.1/ivy/ivy-2.1.0.jar
          [get] Not modified - so not downloaded
    ivy-probe-antlib:
    ivy-init-antlib:
    ivy-init:
    [ivy:configure] :: Ivy 2.1.0 - 20090925235825 :: http://ant.apache.org/ivy/ ::
    [ivy:configure] :: loading settings :: file = /home/hadoop/hadoop-1.2.1/ivy/ivysettings.xml
    ivy-resolve-common:
    [ivy:resolve] 
    [ivy:resolve] :: problems summary ::
    [ivy:resolve] :::: WARNINGS
    [ivy:resolve] 		module not found: commons-logging#commons-logging;1.0.4
    [ivy:resolve] 	==== local: tried
    [ivy:resolve] 	  /home/hadoop/.ivy2/local/commons-logging/commons-logging/1.0.4/ivys/ivy.xml
    [ivy:resolve] 	  -- artifact commons-logging#commons-logging;1.0.4!commons-logging.jar:
    [ivy:resolve] 	  /home/hadoop/.ivy2/local/commons-logging/commons-logging/1.0.4/jars/commons-logging.jar
    [ivy:resolve] 	==== maven2: tried
    [ivy:resolve] 	  http://repo1.maven.org/maven2/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.pom
    [ivy:resolve] 	  -- artifact commons-logging#commons-logging;1.0.4!commons-logging.jar:
    [ivy:resolve] 	  http://repo1.maven.org/maven2/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar
    [ivy:resolve] 	==== oss-sonatype: tried
    [ivy:resolve] 	  https://oss.sonatype.org/content/groups/public/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.pom
    [ivy:resolve] 	  -- artifact commons-logging#commons-logging;1.0.4!commons-logging.jar:
    [ivy:resolve] 	  https://oss.sonatype.org/content/groups/public/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar
    [ivy:resolve] 		::::::::::::::::::::::::::::::::::::::::::::::
    [ivy:resolve] 		::          UNRESOLVED DEPENDENCIES         ::
    [ivy:resolve] 		::::::::::::::::::::::::::::::::::::::::::::::
    [ivy:resolve] 		:: commons-logging#commons-logging;1.0.4: not found
    [ivy:resolve] 		::::::::::::::::::::::::::::::::::::::::::::::
    [ivy:resolve] :::: ERRORS
    [ivy:resolve] 	SERVER ERROR: Gateway Timeout url=http://repo1.maven.org/maven2/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.pom
    [ivy:resolve] 	SERVER ERROR: Gateway Timeout url=http://repo1.maven.org/maven2/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar
    [ivy:resolve] 	SERVER ERROR: Gateway Timeout url=http://repo1.maven.org/maven2/log4j/log4j/1.2.15/log4j-1.2.15.jar
    [ivy:resolve] 
    [ivy:resolve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
    BUILD FAILED
    /home/hadoop/hadoop-1.2.1/src/contrib/build-contrib.xml:492: impossible to resolve dependencies:
    	resolve failed - see output for details
    Total time: 2 minutes 25 seconds
    

    依据错误信息,能够将错误的根源定位到hadoop-1.2.1/src/contrib/ eclipse-plugin/ ivy.xml中的29行rev="${commons-logging.version}"。该值能够在hadoop-1.2.1/ivy/libraries.properties中找到,其原值为1.0.4,改为commons-logging.version=1.1.1就可以。同一时候该输出信息还提示了[echo] eclipse.homeunset: skipping eclipse plugin。此信息提示变量eclipse.home未设置。而该变量在编译插件时是必须的。所以在hadoop-1.2.1/src/contrib/eclipse-plugin/build.xml中加入eclipse的安装文件夹,加入例如以下代码:<propertyname="eclipse.home" value="/home/hadoop/eclipse"/>,该变量的值依据eclipse的实际安装文件夹而定。改动完成后,再次在命令行中输入ant命令,结果例如以下:

     [hadoop@hadoop eclipse-plugin]$ ant
    Buildfile: /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/build.xml
    check-contrib:
    init:
         [echo] contrib: eclipse-plugin
    init-contrib:
    ivy-download:
          [get] Getting: http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.1.0/ivy-2.1.0.jar
          [get] To: /home/hadoop/hadoop-1.2.1/ivy/ivy-2.1.0.jar
          [get] Not modified - so not downloaded
    ivy-probe-antlib:
    ivy-init-antlib:
    ivy-init:
    [ivy:configure] :: Ivy 2.1.0 - 20090925235825 :: http://ant.apache.org/ivy/ ::
    [ivy:configure] :: loading settings :: file = /home/hadoop/hadoop-1.2.1/ivy/ivysettings.xml
    ivy-resolve-common:
    ivy-retrieve-common:
    [ivy:cachepath] DEPRECATED: 'ivy.conf.file' is deprecated, use 'ivy.settings.file' instead
    [ivy:cachepath] :: loading settings :: file = /home/hadoop/hadoop-1.2.1/ivy/ivysettings.xml
    compile:
         [echo] contrib: eclipse-plugin
        [javac] /home/hadoop/hadoop-1.2.1/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 /home/hadoop/hadoop-1.2.1/build/contrib/eclipse-plugin/classes
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFolder.java:28: 软件包 org.apache.hadoop.fs 不存在
        [javac] import org.apache.hadoop.fs.FileStatus;
        [javac]                            ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFolder.java:29: 软件包 org.apache.hadoop.fs 不存在
        [javac] import org.apache.hadoop.fs.Path;
        [javac]                            ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java:25: 软件包 org.apache.hadoop.hdfs 不存在
        [javac] import org.apache.hadoop.hdfs.DistributedFileSystem;
        [javac]                              ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java:29: 软件包 org.apache.hadoop.fs 不存在
        [javac] import org.apache.hadoop.fs.FileSystem;
        [javac]                            ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java:30: 软件包 org.apache.hadoop.fs 不存在
        [javac] import org.apache.hadoop.fs.Path;
        [javac]                            ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:36: 软件包 org.apache.hadoop.conf 不存在
        [javac] import org.apache.hadoop.conf.Configuration;
        [javac]                              ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:38: 软件包 org.apache.hadoop.fs 不存在
        [javac] import org.apache.hadoop.fs.FileSystem;
        [javac]                            ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:39: 软件包 org.apache.hadoop.io 不存在
        [javac] import org.apache.hadoop.io.IOUtils;
        [javac]                            ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:40: 软件包 org.apache.hadoop.mapred 不存在
        [javac] import org.apache.hadoop.mapred.JobClient;
        [javac]                                ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:41: 软件包 org.apache.hadoop.mapred 不存在
        [javac] import org.apache.hadoop.mapred.JobConf;
        [javac]                                ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:42: 软件包 org.apache.hadoop.mapred 不存在
        [javac] import org.apache.hadoop.mapred.JobID;
        [javac]                                ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:43: 软件包 org.apache.hadoop.mapred 不存在
        [javac] import org.apache.hadoop.mapred.JobStatus;
        [javac]                                ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:44: 软件包 org.apache.hadoop.mapred 不存在
        [javac] import org.apache.hadoop.mapred.RunningJob;
        [javac]                                ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFolder.java:54: 找不到符号
        [javac] 符号: 类 Path
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSFolder
        [javac]   private DFSFolder(DFSPath parent, Path path) {
        [javac]                                     ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java:43: 找不到符号
        [javac] 符号: 类 DistributedFileSystem
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSPath
        [javac]   private DistributedFileSystem dfs = null;
        [javac]           ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java:45: 找不到符号
        [javac] 符号: 类 Path
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSPath
        [javac]   protected final Path path;
        [javac]                   ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java:76: 找不到符号
        [javac] 符号: 类 Path
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSPath
        [javac]   protected DFSPath(DFSPath parent, Path path) {
        [javac]                                     ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java:134: 找不到符号
        [javac] 符号: 类 Path
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSPath
        [javac]   public Path getPath() {
        [javac]          ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java:144: 找不到符号
        [javac] 符号: 类 DistributedFileSystem
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSPath
        [javac]   DistributedFileSystem getDFS() throws IOException {
        [javac]   ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSLocationsRoot.java:28: 软件包 org.apache.hadoop.fs 不存在
        [javac] import org.apache.hadoop.fs.FileSystem;
        [javac]                            ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:199: 找不到符号
        [javac] 符号: 类 Configuration
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer
        [javac]   private Configuration conf;
        [javac]           ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:209: 找不到符号
        [javac] 符号: 类 JobID
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer
        [javac]   private transient Map<JobID, HadoopJob> runningJobs =
        [javac]                         ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:24: 软件包 org.apache.hadoop.fs 不存在
        [javac] import org.apache.hadoop.fs.FileSystem;
        [javac]                            ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:25: 软件包 org.apache.hadoop.fs 不存在
        [javac] import org.apache.hadoop.fs.FileUtil;
        [javac]                            ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:26: 软件包 org.apache.hadoop.fs 不存在
        [javac] import org.apache.hadoop.fs.Path;
        [javac]                            ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:27: 软件包 org.apache.hadoop.mapred 不存在
        [javac] import org.apache.hadoop.mapred.Counters;
        [javac]                                ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:28: 软件包 org.apache.hadoop.mapred 不存在
        [javac] import org.apache.hadoop.mapred.JobConf;
        [javac]                                ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:29: 软件包 org.apache.hadoop.mapred 不存在
        [javac] import org.apache.hadoop.mapred.JobID;
        [javac]                                ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:30: 软件包 org.apache.hadoop.mapred 不存在
        [javac] import org.apache.hadoop.mapred.JobStatus;
        [javac]                                ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:31: 软件包 org.apache.hadoop.mapred 不存在
        [javac] import org.apache.hadoop.mapred.RunningJob;
        [javac]                                ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:291: 找不到符号
        [javac] 符号: 类 Configuration
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer
        [javac]   public Configuration getConfiguration() {
        [javac]          ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/ConfProp.java:24: 软件包 org.apache.hadoop.conf 不存在
        [javac] import org.apache.hadoop.conf.Configuration;
        [javac]                              ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:468: 找不到符号
        [javac] 符号: 类 FileSystem
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer
        [javac]   public FileSystem getDFS() throws IOException {
        [javac]          ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:477: 找不到符号
        [javac] 符号: 类 JobClient
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer
        [javac]   public JobClient getJobClient() throws IOException {
        [javac]          ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:76: 找不到符号
        [javac] 符号: 类 JobID
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob
        [javac]   final JobID jobId;
        [javac]         ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:82: 找不到符号
        [javac] 符号: 类 RunningJob
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob
        [javac]   RunningJob running;
        [javac]   ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:89: 找不到符号
        [javac] 符号: 类 JobStatus
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob
        [javac]   JobStatus status;
        [javac]   ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:94: 找不到符号
        [javac] 符号: 类 Counters
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob
        [javac]   Counters counters;
        [javac]   ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:99: 找不到符号
        [javac] 符号: 类 JobConf
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob
        [javac]   JobConf jobConf = null;
        [javac]   ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:127: 找不到符号
        [javac] 符号: 类 JobID
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob
        [javac]   public HadoopJob(HadoopServer location, JobID id, RunningJob running,
        [javac]                                           ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:127: 找不到符号
        [javac] 符号: 类 RunningJob
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob
        [javac]   public HadoopJob(HadoopServer location, JobID id, RunningJob running,
        [javac]                                                     ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:128: 找不到符号
        [javac] 符号: 类 JobStatus
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob
        [javac]       JobStatus status) {
        [javac]       ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:215: 找不到符号
        [javac] 符号: 类 JobID
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob
        [javac]   public JobID getJobID() {
        [javac]          ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:278: 找不到符号
        [javac] 符号: 类 JobStatus
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob
        [javac]   void update(JobStatus status) {
        [javac]               ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:88: 找不到符号
        [javac] 符号: 类 JobClient
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer.LocationStatusUpdater
        [javac]     JobClient client = null;
        [javac]     ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:181: 找不到符号
        [javac] 符号: 类 JobStatus
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer.LocationStatusUpdater
        [javac]     private void updateJob(final HadoopJob job, JobStatus status) {
        [javac]                                                 ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/ConfProp.java:138: 找不到符号
        [javac] 符号: 类 Configuration
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.ConfProp
        [javac]   String get(Configuration conf) {
        [javac]              ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/ConfProp.java:142: 找不到符号
        [javac] 符号: 类 Configuration
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.ConfProp
        [javac]   void set(Configuration conf, String value) {
        [javac]            ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFile.java:34: 软件包 org.apache.hadoop.fs 不存在
        [javac] import org.apache.hadoop.fs.FileStatus;
        [javac]                            ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFile.java:35: 软件包 org.apache.hadoop.fs 不存在
        [javac] import org.apache.hadoop.fs.Path;
        [javac]                            ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFile.java:63: 找不到符号
        [javac] 符号: 类 Path
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSFile
        [javac]   public DFSFile(DFSPath parent, Path path, File file,
        [javac]                                  ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFile.java:70: 找不到符号
        [javac] 符号: 类 Path
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSFile
        [javac]   public DFSFile(DFSPath parent, Path path) {
        [javac]                                  ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/HadoopLocationWizard.java:31: 软件包 org.apache.hadoop.conf 不存在
        [javac] import org.apache.hadoop.conf.Configuration;
        [javac]                              ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/RunOnHadoopWizard.java:31: 软件包 org.apache.hadoop.io 不存在
        [javac] import org.apache.hadoop.io.IOUtils;
        [javac]                            ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/RunOnHadoopWizard.java:32: 软件包 org.apache.hadoop.mapred 不存在
        [javac] import org.apache.hadoop.mapred.JobConf;
        [javac]                                ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/ServerRegistry.java:31: 软件包 org.apache.hadoop.conf 不存在
        [javac] import org.apache.hadoop.conf.Configuration;
        [javac]                              ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java:66: 找不到符号
        [javac] 符号: 类 Path
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSPath
        [javac]     this.path = new Path("/");
        [javac]                     ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java:146: 找不到符号
        [javac] 符号: 类 FileSystem
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSPath
        [javac]       FileSystem fs = location.getDFS();
        [javac]       ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java:147: 找不到符号
        [javac] 符号: 类 DistributedFileSystem
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSPath
        [javac]       if (!(fs instanceof DistributedFileSystem)) {
        [javac]                           ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java:153: 找不到符号
        [javac] 符号: 类 DistributedFileSystem
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSPath
        [javac]       this.dfs = (DistributedFileSystem) fs;
        [javac]                   ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFolder.java:61: 找不到符号
        [javac] 符号: 类 FileStatus
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSFolder
        [javac]     for (FileStatus status : getDFS().listStatus(this.getPath())) {
        [javac]          ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFolder.java:82: 找不到符号
        [javac] 符号: 类 Path
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSFolder
        [javac]       Path filePath = new Path(this.path, file.getName());
        [javac]       ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFolder.java:82: 找不到符号
        [javac] 符号: 类 Path
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSFolder
        [javac]       Path filePath = new Path(this.path, file.getName());
        [javac]                           ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFolder.java:93: 找不到符号
        [javac] 符号: 类 Path
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSFolder
        [javac]       Path filePath = new Path(this.path, file.getName());
        [javac]       ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFolder.java:93: 找不到符号
        [javac] 符号: 类 Path
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSFolder
        [javac]       Path filePath = new Path(this.path, file.getName());
        [javac]                           ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFolder.java:152: 找不到符号
        [javac] 符号: 类 Path
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSFolder
        [javac]       getDFS().mkdirs(new Path(this.path, folderName));
        [javac]                           ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:116: 找不到符号
        [javac] 符号: 类 JobID
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer.LocationStatusUpdater
        [javac]         Set<JobID> missingJobIds =
        [javac]             ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:117: 找不到符号
        [javac] 符号: 类 JobID
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer.LocationStatusUpdater
        [javac]             new HashSet<JobID>(runningJobs.keySet());
        [javac]                         ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:119: 找不到符号
        [javac] 符号: 类 JobStatus
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer.LocationStatusUpdater
        [javac]         JobStatus[] jstatus = client.jobsToComplete();
        [javac]         ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:120: 找不到符号
        [javac] 符号: 类 JobStatus
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer.LocationStatusUpdater
        [javac]         for (JobStatus status : jstatus) {
        [javac]              ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:122: 找不到符号
        [javac] 符号: 类 JobID
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer.LocationStatusUpdater
        [javac]           JobID jobId = status.getJobID();
        [javac]           ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:130: 找不到符号
        [javac] 符号: 类 RunningJob
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer.LocationStatusUpdater
        [javac]               RunningJob running = client.getJob(jobId);
        [javac]               ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:142: 找不到符号
        [javac] 符号: 类 JobID
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer.LocationStatusUpdater
        [javac]         for (JobID jobId : missingJobIds) {
        [javac]              ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:210: 找不到符号
        [javac] 符号: 类 JobID
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer
        [javac]       Collections.synchronizedMap(new TreeMap<JobID, HadoopJob>());
        [javac]                                               ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:224: 找不到符号
        [javac] 符号: 类 Configuration
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer
        [javac]     this.conf = new Configuration();
        [javac]                     ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:238: 找不到符号
        [javac] 符号: 类 Configuration
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer
        [javac]     this.conf = new Configuration();
        [javac]                     ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:338: 找不到符号
        [javac] 符号: 类 Configuration
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer
        [javac]     this.conf = new Configuration(existing.conf);
        [javac]                     ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:354: 找不到符号
        [javac] 符号: 类 Configuration
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer
        [javac]     Configuration newConf = new Configuration(this.conf);
        [javac]     ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:354: 找不到符号
        [javac] 符号: 类 Configuration
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer
        [javac]     Configuration newConf = new Configuration(this.conf);
        [javac]                                 ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:429: 找不到符号
        [javac] 符号: 变量 IOUtils
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer
        [javac]       IOUtils.closeStream(fos);
        [javac]       ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:469: 找不到符号
        [javac] 符号: 变量 FileSystem
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer
        [javac]     return FileSystem.get(this.conf);
        [javac]            ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:478: 找不到符号
        [javac] 符号: 类 JobConf
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer
        [javac]     JobConf jconf = new JobConf(this.conf);
        [javac]     ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:478: 找不到符号
        [javac] 符号: 类 JobConf
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer
        [javac]     JobConf jconf = new JobConf(this.conf);
        [javac]                         ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java:479: 找不到符号
        [javac] 符号: 类 JobClient
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopServer
        [javac]     return new JobClient(jconf);
        [javac]                ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSLocationsRoot.java:131: 找不到符号
        [javac] 符号: 变量 FileSystem
        [javac]           FileSystem.closeAll();
        [javac]           ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:43: 找不到符号
        [javac] 符号: 变量 JobStatus
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob.JobState
        [javac]     PREPARE(JobStatus.PREP), RUNNING(JobStatus.RUNNING), FAILED(
        [javac]             ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:43: 找不到符号
        [javac] 符号: 变量 JobStatus
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob.JobState
        [javac]     PREPARE(JobStatus.PREP), RUNNING(JobStatus.RUNNING), FAILED(
        [javac]                                      ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:44: 找不到符号
        [javac] 符号: 变量 JobStatus
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob.JobState
        [javac]         JobStatus.FAILED), SUCCEEDED(JobStatus.SUCCEEDED);
        [javac]         ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:44: 找不到符号
        [javac] 符号: 变量 JobStatus
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob.JobState
        [javac]         JobStatus.FAILED), SUCCEEDED(JobStatus.SUCCEEDED);
        [javac]                                      ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:54: 找不到符号
        [javac] 符号: 变量 JobStatus
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob.JobState
        [javac]         case JobStatus.PREP:
        [javac]              ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:56: 找不到符号
        [javac] 符号: 变量 JobStatus
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob.JobState
        [javac]         case JobStatus.RUNNING:
        [javac]              ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:58: 找不到符号
        [javac] 符号: 变量 JobStatus
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob.JobState
        [javac]         case JobStatus.FAILED:
        [javac]              ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:60: 找不到符号
        [javac] 符号: 变量 JobStatus
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob.JobState
        [javac]         case JobStatus.SUCCEEDED:
        [javac]              ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:146: 找不到符号
        [javac] 符号: 类 FileSystem
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob
        [javac]       FileSystem fs = location.getDFS();
        [javac]       ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:148: 找不到符号
        [javac] 符号: 类 Path
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob
        [javac]       if (FileUtil.copy(fs, new Path(jobFile), tmp, false, location
        [javac]                                 ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:148: 找不到符号
        [javac] 符号: 变量 FileUtil
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob
        [javac]       if (FileUtil.copy(fs, new Path(jobFile), tmp, false, location
        [javac]           ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:150: 找不到符号
        [javac] 符号: 类 JobConf
        [javac] 位置: 类 org.apache.hadoop.eclipse.server.HadoopJob
        [javac]         this.jobConf = new JobConf(tmp.toString());
        [javac]                            ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:302: 软件包 Counters 不存在
        [javac]       Counters.Group group = counters.getGroup(groupName);
        [javac]               ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java:305: 软件包 Counters 不存在
        [javac]       for (Counters.Counter counter : group) {
        [javac]                    ^
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFile.java:74: 找不到符号
        [javac] 符号: 类 FileStatus
        [javac] 位置: 类 org.apache.hadoop.eclipse.dfs.DFSFile
        [javac]       FileStatus fs = getDFS().getFileStatus(path);
        [javac]       ^
        [javac] 注意:某些输入文件使用或覆盖了已过时的 API。

    [javac] 注意:要了解具体信息,请使用 -Xlint:deprecation 又一次编译。 [javac] 注意:某些输入文件使用了未经检查或不安全的操作。

    [javac] 注意:要了解具体信息,请使用 -Xlint:unchecked 又一次编译。 [javac] 100 错误 BUILD FAILED /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/build.xml:61: Compile failed; see the compiler error output for details. Total time: 12 seconds

    由错误信息可知,classpath中没有包括hadoop对应的jar包。解决方法为在hadoop-1.2.1/src/contrib/eclipse-plugin/build.xml中加入以下的代码:

     <path>
             <filesetdir="${hadoop.root}">
               <include name="hadoop*.jar"/>
             </fileset>
        </path>

    同一时候将hadoop-1.2.1/src/contrib/eclipse-plugin/build.xml中的<copyfile="${hadoop.root}/build/hadoop-core-${version}.jar" tofile="${build.dir}/lib/hadoop-core.jar"verbose="true"/>为<copy file="${hadoop.root}/hadoop-core-${version}.jar"tofile="${build.dir}/lib/hadoop-core.jar"verbose="true"/>,做完这些改动后,再次运行ant命令:

    [hadoop@hadoop eclipse-plugin]$ ant
    Buildfile: /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/build.xml
    check-contrib:
    init:
         [echo] contrib: eclipse-plugin
    init-contrib:
    ivy-download:
          [get] Getting: http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.1.0/ivy-2.1.0.jar
          [get] To: /home/hadoop/hadoop-1.2.1/ivy/ivy-2.1.0.jar
          [get] Not modified - so not downloaded
    ivy-probe-antlib:
    ivy-init-antlib:
    ivy-init:
    [ivy:configure] :: Ivy 2.1.0 - 20090925235825 :: http://ant.apache.org/ivy/ ::
    [ivy:configure] :: loading settings :: file = /home/hadoop/hadoop-1.2.1/ivy/ivysettings.xml
    ivy-resolve-common:
    ivy-retrieve-common:
    [ivy:cachepath] DEPRECATED: 'ivy.conf.file' is deprecated, use 'ivy.settings.file' instead
    [ivy:cachepath] :: loading settings :: file = /home/hadoop/hadoop-1.2.1/ivy/ivysettings.xml
    compile:
         [echo] contrib: eclipse-plugin
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/build.xml:66: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
        [javac] Compiling 45 source files to /home/hadoop/hadoop-1.2.1/build/contrib/eclipse-plugin/classes
        [javac] 注意:某些输入文件使用或覆盖了已过时的 API。

    [javac] 注意:要了解具体信息,请使用 -Xlint:deprecation 又一次编译。

    [javac] 注意:某些输入文件使用了未经检查或不安全的操作。 [javac] 注意:要了解具体信息。请使用 -Xlint:unchecked 又一次编译。 jar: [mkdir] Created dir: /home/hadoop/hadoop-1.2.1/build/contrib/eclipse-plugin/lib BUILD FAILED /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/build.xml:74: Warning: Could not find file /home/hadoop/hadoop-1.2.1/hadoop-core-${version}.jar to copy. Total time: 8 seconds

    这次编译失败的原因是找不到hadoop-core-${version}.jar,也就是变量${version}没有定义,事实上在/hadoop-1.2.1/ivy/libraries.properties中定义了hadoop.version=1.2.1而不是version变量,或者将version替换为hadoop.version。或者在build.xml加入变量version,此次编译过程中选择后者<property name="version" value="1.2.1"/>,再次运行ant:

     [hadoop@hadoop eclipse-plugin]$ ant
    Buildfile: /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/build.xml
    check-contrib:
    init:
         [echo] contrib: eclipse-plugin
    init-contrib:
    ivy-download:
          [get] Getting: http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.1.0/ivy-2.1.0.jar
          [get] To: /home/hadoop/hadoop-1.2.1/ivy/ivy-2.1.0.jar
          [get] Not modified - so not downloaded
    ivy-probe-antlib:
    ivy-init-antlib:
    ivy-init:
    [ivy:configure] :: Ivy 2.1.0 - 20090925235825 :: http://ant.apache.org/ivy/ ::
    [ivy:configure] :: loading settings :: file = /home/hadoop/hadoop-1.2.1/ivy/ivysettings.xml
    ivy-resolve-common:
    ivy-retrieve-common:
    [ivy:cachepath] DEPRECATED: 'ivy.conf.file' is deprecated, use 'ivy.settings.file' instead
    [ivy:cachepath] :: loading settings :: file = /home/hadoop/hadoop-1.2.1/ivy/ivysettings.xml
    compile:
         [echo] contrib: eclipse-plugin
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/build.xml:67: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    jar:
         [copy] Copying 1 file to /home/hadoop/hadoop-1.2.1/build/contrib/eclipse-plugin/lib
         [copy] Copying /home/hadoop/hadoop-1.2.1/hadoop-core-1.2.1.jar to /home/hadoop/hadoop-1.2.1/build/contrib/eclipse-plugin/lib/hadoop-core.jar
    BUILD FAILED
    /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/build.xml:76: Warning: Could not find file /home/hadoop/hadoop-1.2.1/build/ivy/lib/Hadoop/common/commons-cli-1.2.jar to copy.
    Total time: 17 seconds
    

    失败原因是找不到commons-cli-1.2.jar。

    修复方法是改动build.xml文件,将<copy file="${hadoop.root}/build/ivy/lib/Hadoop/common/commons-cli-${commons-cli.version}.jar"  todir="${build.dir}/lib"verbose="true"/>改动为<copyfile="${hadoop.root}/lib/commons-cli-${commons-cli.version}.jar"  todir="${build.dir}/lib"verbose="true"/>,再次运行ant:

    [hadoop@hadoop eclipse-plugin]$ ant
    Buildfile: /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/ build.xml
    check-contrib:
    init:
         [echo] contrib: eclipse-plugin
    init-contrib:
    ivy-download:
          [get] Getting: http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.1.0/ivy-2.1.0.jar
          [get] To: /home/hadoop/hadoop-1.2.1/ivy/ivy-2.1.0.jar
          [get] Not modified - so not downloaded
    ivy-probe-antlib:
    ivy-init-antlib:
    ivy-init:
    [ivy:configure] :: Ivy 2.1.0 - 20090925235825 :: http://ant.apache.org/ivy/ ::
    [ivy:configure] :: loading settings :: file = /home/hadoop/hadoop-1.2.1/ivy/ivysettings.xml
    ivy-resolve-common:
    ivy-retrieve-common:
    [ivy:cachepath] DEPRECATED: 'ivy.conf.file' is deprecated, use 'ivy.settings.file' instead
    [ivy:cachepath] :: loading settings :: file = /home/hadoop/hadoop-1.2.1/ivy/ivysettings.xml
    compile:
         [echo] contrib: eclipse-plugin
        [javac] /home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/build.xml:67: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    jar:
         [copy] Copying 1 file to /home/hadoop/hadoop-1.2.1/build/contrib/eclipse-plugin/lib
         [copy] Copying /home/hadoop/hadoop-1.2.1/lib/commons-cli-1.2.jar to /home/hadoop/hadoop-1.2.1/build/contrib/eclipse-plugin/lib/commons-cli-1.2.jar
          [jar] Building jar: /home/hadoop/hadoop-1.2.1/build/contrib/eclipse-plugin/hadoop-eclipse-plugin-1.2.1.jar
    BUILD SUCCESSFUL
    Total time: 10 seconds
    

    至此编译hadoop的eclipse插件成功完毕。接下来试试能否够正常工作,将编译成功的hadoop-1.2.1/build/contrib/eclipse-plugin/hadoop-eclipse-plugin-1.2.1.jar文件复制到eclipse下的plugins文件夹中,然后启动eclipse,在File菜单下选择New子菜单下的Other,弹出以下的窗体。能够发现已经有了Map/Reduce,说明插件已经生效。




  • 相关阅读:
    当spfile文件中的参数修改错误,导致数据库无法启动问题
    oracle的shared server模式和dedicated server模式
    概述oracle的内存结构
    oracle进程简介
    TNS12516及ORA12516错误解决
    如何打补丁及升级
    关于sqlplus的简单概述
    修改参数之后数据库无法启动问题
    oracle的后台进程杀掉会有什么影响
    远程连接oracle数据库ORA12154错误
  • 原文地址:https://www.cnblogs.com/yxwkf/p/5212565.html
Copyright © 2020-2023  润新知