hadoop cdh4 eclipse plugin

参考了很多mapre1 插件生成文档,大部分都是hadoop标准版本的,这里给个CDH4的,仅供参考。
参考了标准hadoop生成流程: http://m.blog.csdn.net/blog/u010415792/8976261

1)download eclipse
2)解压 eclipse
3)安装与配置 Ant 修 改 /etc/profile 文件
export ANT_HOME=[path]/apache-ant-1.7.1
export PATH=$PATH$:$ANT_HOME/bin
source /etc/profile
4)安装 JDK   1.6 以上版本
5)hadoop-2.0.0-cdh4.6.0/src/hadoop-mapreduce1-project/src/contrib/eclipse-plugin/build.properties
增加
eclipse.home=[path]/eclipse
reactor.repo=https://repository.cloudera.com/content/repositories/snapshots
version=2.0.0-cdh4.4.0
参考:http://stackoverflow.com/questions/18852338/ant-build-for-eclipse-cant-resolve-log4j 
否则会有提示:
[ivy:resolve]       :: commons-logging#commons-logging;1.1.1: several problems occurred while resolving dependency: commons-logging#commons-logging;1.1.1 {common=[default]}:
[ivy:resolve]   reactor-repo: unable to get resource for commons-logging#commons-logging;1.1.1: res=${reactor.repo}/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom: java.net.MalformedURLException: no protocol: ${reactor.repo}/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom
[ivy:resolve]   several problems occurred while resolving dependency: org.apache.commons#commons-parent;5 {}:
[ivy:resolve]   reactor-repo: unable to get resource for org/apache/commons#commons-parent;5: res=${reactor.repo}/org/apache/commons/commons-parent/5/commons-parent-5.pom: java.net.MalformedURLException: no protocol: ${reactor.repo}/org/apache/commons/commons-parent/5/commons-parent-5.pom
[ivy:resolve]   several problems occurred while resolving dependency: org.apache#apache;4 {}:
[ivy:resolve]   reactor-repo: unable to get resource for org/apache#apache;4: res=${reactor.repo}/org/apache/apache/4/apache-4.pom: java.net.MalformedURLException: no protocol: ${reactor.repo}/org/apache/apache/4/apache-4.pom
[ivy:resolve]   reactor-repo: unable to get resource for org/apache#apache;4: res=${reactor.repo}/org/apache/apache/4/apache-4.jar: java.net.MalformedURLException: no protocol: ${reactor.repo}/org/apache/apache/4/apache-4.jar
[ivy:resolve]       :: log4j#log4j;1.2.16: several problems occurred while resolving dependency: log4j#log4j;1.2.16 {common=[master]}:
[ivy:resolve]   reactor-repo: unable to get resource for log4j#log4j;1.2.16: res=${reactor.repo}/log4j/log4j/1.2.16/log4j-1.2.16.pom: java.net.MalformedURLException: no protocol: ${reactor.repo}/log4j/log4j/1.2.16/log4j-1.2.16.pom
[ivy:resolve]   reactor-repo: unable to get resource for log4j#log4j;1.2.16: res=${reactor.repo}/log4j/log4j/1.2.16/log4j-1.2.16.jar: java.net.MalformedURLException: no protocol: ${reactor.repo}/log4j/log4j/1.2.16/log4j-1.2.16.jar
[ivy:resolve]       ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] 
[ivy:resolve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS

6)hadoop-2.0.0-cdh4.6.0/src/hadoop-mapreduce1-project/src/contrib/eclipse-plugin/build-contrib.xml
增加

    --添加部分
                --添加部分
  
  
  


 
 

7)修改${HADOOP_HOME}/src/contrib/eclipse-plugin/build.xml文件
               --添加部分
直接全路径吧,这是示例:
	        			--添加部分
                             				--添加部分


注:如还有缺少,继续添加其他包的引入

8)hadoop-2.0.0-cdh4.6.0/src/hadoop-mapreduce1-project/src/contrib/eclipse-plugin目录下
ant jar
按提示有未定义的,再引入jar库

9)错误提示:case需要常量,修改如下文件
./src/hadoop-mapreduce1-project/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java

static JobState ofInt(int state) {
     switch (state) {
      // case JobStatus.PREP:
       case 4:
         return PREPARE;
     //  case JobStatus.RUNNING:
       case 1:
         return RUNNING;
      // case JobStatus.FAILED:
       case 3:
         return FAILED;
     //  case JobStatus.SUCCEEDED:
       case 2:
         return SUCCEEDED;
       default:
         return null;
      }  
    }

10)编译通过后,在
hadoop-2.0.0-cdh4.6.0/src/hadoop-mapreduce1-project/build/contrib/eclipse-plugin
包含 hadoop-eclipse-plugin-2.0.0.jar 拷贝到eclipse的目录下重启elcipse


如果是yarn 框架的还是用新的mapre2的吧~~~~~


你可能感兴趣的:(mapreduce,eclipse,hadoop)