天天看點

windows7 64位cygwin環境maven編譯hadoop2.7.1

主要參照BUILDING.txt的操作來

* JDK 1.7+
* Maven 3.0 or later
* Findbugs 1.3.9 (if running findbugs)
* ProtocolBuffer 2.5.0
* CMake 2.6 or newer
* Windows SDK 7.1 or Visual Studio 2010 Professional
* Windows SDK 8.1 (if building CPU rate control for the container executor)
* zlib headers (if building native code bindings for zlib)
* Internet connection for first build (to fetch all Maven and Hadoop dependencies)
* Unix command-line tools from GnuWin32: sh, mkdir, rm, cp, tar, gzip. These tools must be present on your PATH. 如cygwin、mingw
*從cygwin安裝包安裝openssl包
   Net 下的:openssh,openssl
   Base 下的:sed (若需要Eclipse,必須sed)
   Devel 下的:subversion(建議安裝)
* svn command
* git command
* vs2010 professional
           

1、下載下傳hadoop-2.7.1-src.tar.gz并解壓到D根目錄,建議檔案名越短越好,太長windows報錯

2、修改源檔案hadoop-2.7.1-src\hadoop-common-project\hadoop-common\src\main\java\org\apache\hadoop\fs\FileUtil.java,防止出現權限錯誤

private static void checkReturnValue(boolean rv, File p, 
                                       FsPermission permission
                                       ) throws IOException {
    //if (!rv) {
    //  throw new IOException("Failed to set permissions of path: " + p + 
    //                        " to " + 
    //                        String.format("%04o", permission.toShort()));
    //}
  }
           

3、可能會碰到hadoop-common-project\hadoop-common\src\main\native\native.sln編譯不過去,主要是找不到zlib.h,手動打開sln,添加include路徑即可

4、

* Maven 3.0 or later
* Findbugs 1.3.9 (if running findbugs)
* ProtocolBuffer 2.5.0
* CMake 2.6 or newer
           

這幾個指令一定要加載PATH路徑下面.

5、源檔案根目錄執行mvn package -Pdist,native-win,docs -DskipTests -Dtar等待build sucess

6、cd hadoop-maven-plugins,執行mvn install

7、嫌預設maven源下載下傳慢的可以修改conf/settings.xml

<mirrors>
    <mirror>
		 <id>nexus-osc</id>
         <mirrorOf>*</mirrorOf>
		 <name>Nexusosc</name>
		 <url>http://maven.oschina.net/content/groups/public/</url>
    </mirror>
     
  </mirrors>

  <profiles>
	<profile>
       <id>jdk-1.8</id>
       <activation>
         <jdk>1.8</jdk>
       </activation>
       <repositories>
         <repository>
           <id>nexus</id>
           <name>local private nexus</name>
           <url>http://maven.oschina.net/content/groups/public/</url>
           <releases>
             <enabled>true</enabled>
           </releases>
           <snapshots>
             <enabled>false</enabled>
           </snapshots>
         </repository>
       </repositories>
       <pluginRepositories>
         <pluginRepository>
           <id>nexus</id>
          <name>local private nexus</name>
           <url>http://maven.oschina.net/content/groups/public/</url>
           <releases>
             <enabled>true</enabled>
           </releases>
           <snapshots>
             <enabled>false</enabled>
           </snapshots>
         </pluginRepository>
       </pluginRepositories>
     </profile>
  </profiles>
           

繼續閱讀