编译指令:mvn package -Pdist -DskipTests -Dtar
1.用maven编译hadoop2.4.0源码时,使用jdk1.7,千万不要使用1.8.
会报下面错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.8.1:jar (module-javadocs) on project hadoop-annotations: MavenReportException: Error while creating archive:
[ERROR] Exit code: 1 - /home/hadoop/hadoop-2.4.0-src/hadoop-common-project/hadoop-annotations/src/main/java/org/apache/hadoop/classification/InterfaceStability.java:27: error: unexpected end tag: </ul>
[ERROR] * </ul>
[ERROR] ^
[ERROR]
2.Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7.1 ,An Ant BuildException has occured Warning: Could not find file ….错误
可能的原因: 有可能你在使用的版本是maven3.X,其执行maven-ant-plugin的行为和maven2.x有一定的不同,需要引入pluginManagement
解决办法是:在相关文件夹中的pom.xml文件中引入:<pluginManagement></pluginManagement
之前的内容:
<build>
<plugins>
<plugin></plugin>
…
<plugin></plugin>
</plugins>
</build>
修改后的内容:
<build>
<pluginManagement>
<plugins>
<plugin></plugin>
…
<plugin></plugin>
</plugins>
</pluginManagement>
</build>
3.同时,由于在编译过程中经常出现.m2仓库中缺少或maven自动下载失败的文件,比如apache-tomcat-6.0.36.tar.gz文件,可以直接在
http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.36/bin/apache-tomcat-6.0.36.tar.gz
网址中下载下来,移植到.m2相应的文件中
4.网络代理设置:
maven在编译hadoop2.4.0时经常出现下载问题,可能与你的network代理有关:
需要参考http://maven.apache.org/guides/mini/guide-proxies.html进行设置代理(maven/conf中的setting.xml和.m2中的setting.xml需要改一下):
<settings>
.
.
<proxies>
<proxy>
<id>example-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
</proxy>
</proxies>
.
.
</settings>
具体的安装各个编译工具,可以参考:
http://www.aboutyun.com/thread-8130-1-1.html
http://blog.csdn.net/jiangzeyun/article/details/29922907