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
增加
<project name="hadoopbuildcontrib" xmlns:ivy="antlib:org.apache.ivy.ant">
  <property name="eclipse.home"location="C:\eclipse"/>  --添加部分
  <property name="version" value="1.0.4"/>              --添加部分
  <property name="name" value="${ant.project.name}"/>
  <property name="root" value="${basedir}"/>
  <property name="hadoop.root" location="${root}/../../../"/>


 
 

7)修改${HADOOP_HOME}/src/contrib/eclipse-plugin/build.xml文件
<fileset dir="[path to lib of mapreduce1]">               --添加部分
直接全路径吧,这是示例:<fileset dir="./share/hadoop/mapreduce1/lib/">
	<include name="hadoop*.jar"/>        			--添加部分
</fileset>                             				--添加部分


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

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的吧~~~~~


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值