首页 > 代码库 > 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.导入
- 将hadoop源码解压到一个目录,注意目录层次不要太深,否则可能无法解压。
- 进入hadoop-maven-plugins文件夹,执行 mvn install
- 返回源码根目录,执行 mvn eclipse:eclipse –DskipTests
- eclipse在任意目录创建新的WorkSpace
- eclipse设置Maven:window->preference->maven->{Installations...;user Settings:maven\conf\settings.xml}
- eclipse:File->inport->Existing Projects into WorkSpace->Hadoop源码根目录
3.错误处理
- maven下载pom失败->重新操作
- hadoop-streaming中build path错误->Java Build Path->Source:
- 删除...hadoop-yarn-server-resourcemanager/conf
- Link Source:源码根目录/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/conf,再随便起个名字;inclusion patterns:capacity-scheduler.xml;exclusion patters:**/*.java
- org.apache.hadoop.io.serializer.avro.TestAvroSerialization
- 下载avro-tools-1.7.4.jar:http://archive.apache.org/dist/avro/avro-1.7.4/java/
- 进入目录:源码根目录\hadoop-common-project\hadoop-common\src\test\avro
- java -jar path/to/avro-tools-1.7.4.jar compile schema avroRecord.avsc ..\java
- eclipse 刷新
- org.apache.hadoop.ipc.protobuf.TestProtos
- 进入目录:源码根目录\hadoop-common-project\hadoop-common\src\test\proto
- protoc --java_out=../java *.proto
- eclipse 刷新
- project->clean..->clean all projects & Build the entire workspace
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。