Eclipse 导入 Hadoop 源码

Eclipse 导入 Hadoop 源码

1.准备工作

  • jdk:
  • eclipse:
  • Maven:
  • libprotoc :https://developers.google.com/protocol-buffers/
  • hadoop:http://www.apache.org/dyn/closer.cgi/hadoop/common/

 

添加开源中国maven库:http://maven.oschina.net/home.html

maven\conf\settings.xml

<localRepository>path</localRepository>

复制代码
<localRepository>path</localRepository>
<mirrors>
    <mirror>
        <id>nexus-osc</id>
        <mirrorOf>*</mirrorOf>
        <name>Nexus osc</name>
        <url>http://maven.oschina.net/content/groups/public/</url>
    </mirror>
</mirrors>
复制代码

 

2.导入

  1. 将hadoop源码解压到一个目录,注意目录层次不要太深,否则可能无法解压。
  2. 进入hadoop-maven-plugins文件夹,执行 mvn install 
  3. 返回源码根目录,执行 mvn eclipse:eclipse –DskipTests 
  4. eclipse在任意目录创建新的WorkSpace
  5. eclipse设置Maven:window->preference->maven->{Installations...;user Settings:maven\conf\settings.xml}
  6. eclipse:File->inport->Existing Projects into WorkSpace->Hadoop源码根目录

3.错误处理

  1. maven下载pom失败->重新操作
  2. hadoop-streaming中build path错误->Java Build Path->Source:
    1. 删除...hadoop-yarn-server-resourcemanager/conf
    2. Link Source:源码根目录/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/conf,再随便起个名字;inclusion patterns:capacity-scheduler.xml;exclusion patters:**/*.java
  3. org.apache.hadoop.io.serializer.avro.TestAvroSerialization
    1. 下载avro-tools-1.7.4.jar:http://archive.apache.org/dist/avro/avro-1.7.4/java/
    2. 进入目录:源码根目录\hadoop-common-project\hadoop-common\src\test\avro
    3. java -jar path/to/avro-tools-1.7.4.jar compile schema avroRecord.avsc ..\java
    4. eclipse 刷新
  4. org.apache.hadoop.ipc.protobuf.TestProtos
    1. 进入目录:源码根目录\hadoop-common-project\hadoop-common\src\test\proto
    2. protoc --java_out=../java *.proto
    3. eclipse 刷新
  5. project->clean..->clean all projects & Build the entire workspace


http://www.cnblogs.com/errorx/p/3779578.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值