Http://www.cnblogs.com/errorx/p/3779578.html
1. Preparatory work
- Jdk:
- Eclipse:
- Maven:
- libprotoc:https://developers.google.com/protocol-buffers/
- hadoop:http://www.apache.org/dyn/closer.cgi/hadoop/common/
Add Open source China Maven Library: 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. Import
- Extract the Hadoop source to a directory, note that the directory hierarchy is not too deep, otherwise it may not be decompressed.
- Go to Hadoop-maven-plugins folder, execute mvn install
- Return to source root directory, execute mvn eclipse:eclipse–dskiptests
- Eclipse creates a new workspace in any directory
- Eclipse Settings maven:window->preference->maven->{installations...; User Settings:maven\conf\settings.xml}
- Eclipse:file->inport->existing Projects into Workspace->hadoop source root directory
3. Error handling
- Maven Download POM Failure--re-operation
- Hadoop-streaming Build Path Error->java build Path->source:
- Delete ... hadoop-yarn-server-resourcemanager/conf
- Link Source: Source root directory/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/conf, and a name inclusion patterns:capacity-scheduler.xml;exclusion Patters:**/*.java
- Org.apache.hadoop.io.serializer.avro.TestAvroSerialization
- Download avro-tools-1.7.4.jar:http://archive.apache.org/dist/avro/avro-1.7.4/java/
- Access directory: Source root directory \hadoop-common-project\hadoop-common\src\test\avro
- Java-jar Path/to/avro-tools-1.7.4.jar Compile schema AVRORECORD.AVSC. \java
- Eclipse Refresh
- Org.apache.hadoop.ipc.protobuf.TestProtos
- Access directory: Source root directory \hadoop-common-project\hadoop-common\src\test\proto
- Protoc--java_out=. /java *.proto
- Eclipse Refresh
- Project->clean. ->clean all projects & Build the entire workspace
Import Eclipse Import/compile Hadoop source code