环境:
SVN或者小乌龟
ant
maven
protoc(http://download.csdn.net/detail/can007/5816063)
VS2010
第一步:从SVN下载code
使用Eclipse插件或者小乌龟从https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2.2.0,获得源码。
第二步:配置Maven和ANT的环境变量
第三步:修改Maven中的mvn.bat添加 set MAVEN_OPTS= -Xms128m -Xmx1024m
第四步:进入下载的源码目录,运行mvn install -DskipTests
第五步:修改E:\workSpace\Hadoop 2.2 branch\hadoop-common-project\hadoop-auth,添加以下部分到pom.xml:
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<scope>test</scope>
</dependency>
如不做:/home/killua/Workspace/hadoop-2.2.0-src/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[88,11] error: cannot access AbstractLifeCycle错误
第六步:解压下载protoc-2.5.0-win32.zip到:C:\Windows\System32,注意2.2必须使用2.5.0
第七步:注解掉E:\workSpace\Hadoop 2.2 branch\hadoop-common-project\hadoop-common中pom.xml的下面部分:
<!-- <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>compile-ms-winutils</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>msbuild</executable>
<arguments>
<argument>${basedir}/src/main/winutils/winutils.sln</argument>
<argument>/nologo</argument>
<argument>/p:Configuration=Release</argument>
<argument>/p:OutDir=${project.build.directory}/bin/</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>compile-ms-native-dll</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>msbuild</executable>
<arguments>
<argument>${basedir}/src/main/native/native.sln</argument>
<argument>/nologo</argument>
<argument>/p:Configuration=Release</argument>
<argument>/p:OutDir=${project.build.directory}/bin/</argument>
<argument>/p:CustomSnappyPrefix=${snappy.prefix}</argument>
<argument>/p:CustomSnappyLib=${snappy.lib}</argument>
<argument>/p:CustomSnappyInclude=${snappy.include}</argument>
<argument>/p:RequireSnappy=${require.snappy}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>-->
网上也有要求去下VS2010的做法但是按照那个方法做完会出现下面的错误:
ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:exec (compile-ms-winutils) on project hadoop-common: Command execution failed. Process exited with an error: -2146232576(Exit value: -2146232576) -> [Help 1]
这个问题解决了好几个小时,郁闷啊
第八步:进入源码目录,运行mvn install -DskipTests
第九步:运行mvn eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true,漫长的等待啊
第十步:导入项目到Eclipse