mvn package -Pdist,native,docs -DskipTests -Dtar
(1)问题1
解决方案: https://issues.apache.org/jira/browse/HADOOP-10110
hadoop-common-project/hadoop-auth/pom.xml 文件进行如下patch
--- hadoop-common-project/hadoop-auth/pom.xml (revision 1543124) +++ hadoop-common-project/hadoop-auth/pom.xml (working copy) @@ -54,6 +54,11 @@ </dependency> <dependency> <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty-util</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mortbay.jetty</groupId> <artifactId>jetty</artifactId> <scope>test</scope> </dependency>
(2)问题2
ailed to execute goal org.apache.maven.plugins:maven-site-plugin:3.0:site (default-site) on project hadoop-main: Execution default-site of goal org.apache.maven.plugins:maven-site-plugin:3.0:site failed: A required class was missing while executing org.apache.maven.plugins:maven-site-plugin:3.0:site: org/sonatype/aether/graph/DependencyFilter
解决方案:http://dougchang333.blogspot.com/2013/11/hadoop-build-error-javalangnoclassdeffo.html
Make sure to change the pom.xml maven-site-plugin to 3.3 in both places. Someone should log a jira ticket and make this a property and set it to 3.3
(3)问题3
有三种可能:
第一,protobuf 没有装好,可以protoc --version测试一下。
第二,findbugs没装,没装去网上找教程。
第三,sudo apt-get install maven build-essential autoconf automake libtool cmake zlib1g-dev pkg-config libssl-dev,检查是否所有的包都装过了。最后发现,是由于libssl-dev的原因。
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (make) on project hadoop-hdfs: An Ant BuildException has occured: exec returned: 1 -> [Help 1]
安装libglib2.0-dev 或者 安装libssl-dev
其他常见问题:
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
安装build-essential
另外,介绍打包命令的不同:
创建二进制分发版,不带native code和文档:
$ mvn package -Pdist -DskipTests -Dtar
创建二进制分发版,带native code和文档:
$ mvn package -Pdist,native,docs -DskipTests -Dtar
创建源码分发版
$ mvn package -Psrc -DskipTests
创建二进制带源码分发版,带native code和文档:
$ mvn package -Pdist,native,docs,src -DskipTests -Dtar
创建本地版web页面,放在/tmp/hadoop-site
$ mvn clean site; mvn site:stage -DstagingDirectory=/tmp/hadoop-site
我在编译过程中只遇到以上三种情况。网上各种问题较散,望大家耐心解决问题。