云计算(十七)- Windows下编译Hadoop2.2源码并引入eclipse

环境:

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


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值