问题导读
1.cmake安装有什么需要注意的地方?
2.编译hadoop cdh5.4需要哪些软件,版本分别是哪些?
3.通过什么命令可以编译hadoop cdh5.4?
我的环境系统:win8.1 , maven3.1, eclipse 4.4 hadoop cdh5.4对应apache的源码是hadoop 2.6 准备条件安装以下软件,见源码src/BUILDING.txt里的要求
jdk1.7
protoc.exe 2.5
cygwin
maven3
cygwin
cmake (注意要单独安装,不要使用cygwin里面的,否则在编译hadoop-hdfs会有cmake错误)
Windows SDK 或者 Visual Studio 2010 Professional(我用的是Windows SDK) 配置环境变量JAVA_HOME等,把下载的protoc.exe放入c:\windows
下载源码略
编译使用”Windows SDK 7.1 Command Prompt”进入命令行 [mw_shl_code=bash,true]mvn org.apache.maven.plugins:maven-eclipse-plugin:2.6:eclipse
mvn package -Pdist,native-win -DskipTests -Dtar[/mw_shl_code]
导入eclipse为了使得Eclipse中安装的Maven插件,同windows中安装的那个相同,需要让eclipse中的maven重新定位一下,点击Window -> Preference -> Maven -> Installation -> Add进行设置 使用import -> Existing Projects into Workspace方式导入
错误处理
报错 Request to merge when ‘filtering’ is not identicalFailed to execute goal org.apache.maven.plugins:maven-eclipse-plugin:2.8:eclipse (default-cli) on project hadoop-yarn-common: Request to merge when 'filtering' is not identical. Original=resource src/main/resources: output=target/classes, include=[], exclude=[yarn-version-info.properties|**/*.java], test=false, filtering=false, merging with=resource src/main/resources: output=target/classes, include=[yarn-version-info.properties], exclude=[**/*.java], test=false, filtering=true -> [Help 1]改用mvn org.apache.maven.plugins:maven-eclipse-plugin:2.6:eclipse 编译 或者修改hadoop-2.6.0-cdh5.4.0\src\hadoop-common-project\hadoop-common\pom.xml文件,加入 [mw_shl_code=xml,true]<build>
...
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.6</version>
</plugin>
</plugins>
</build>[/mw_shl_code]来源
报错 EchoRequestProto cannot be resolved在根src目录下执行一次 mvn install -DskipTests
你会看到最终这个是在hadoop-common*test.jar包里面的,应该是由hadoop-common-project\hadoop-common\src\test\proto编译出来的
报错 AvroRecord cannot be resolved把hadoop-common*test.jar加入bulid path,或者下载下载avro-tools-x.x.x.jar,进入源码根目录下的“hadoop-common-project\hadoop-common\src\test\avro”执行命令,java -jar <所在目录>/avro-tools-1.7.7.jar compile schema avroRecord.avsc ..\java
报错 ApplicationAttemptStartDataPBImpl cannot be resolved这个是因为解压的时候失败了,导致文件丢失。还有一个文件是ApplicationAttemptStartDataPBImpl,目录在hadoop-2.6.0-cdh5.4.0\src\hadoop-yarn-project\hadoop-yarn\hadoop-yarn-server\hadoop-yarn-server-applicationhistoryservice\src\main\java\org\apache\hadoop\yarn\server\applicationhistoryservice\records\impl\pb
在Windows下文件名目录不能长于260个字符,想办法把目录缩短一些,然后把文件拷贝回来。
导入eclipse后maven jdk.tools报错修改hadoop-annotations/pom.xml,找到jdk.tools,把“java.home../”改为“{JAVA_HOME}/”,也就是jdk下面的tools.jar路径
提示maven-resource-plugin版本低于2.4错误修改pom.xml文件,把版本改为2.4,忘记是哪个pom了
maven报错lifecycle错误在eclipse配置maven,把这些错误忽略掉。
|