mahout 0.9 for hadoop 2.2.0 源码编译

克隆源码

git clone https://github.com/apache/mahout.git

或者直接下载mahout-distribution-0.9-src.tar.gz

切换到mahout-0.9 tag

git tag   ###列出所有的标签
git checkout -b mahout-0.9 mahout-0.9 ## 创建和切换到mahout-0.9分支

打补丁

https://issues.apache.org/jira/browse/MAHOUT-1329

下载上面链接中的补丁文件,然后使用patch命令打补丁

wget https://issues.apache.org/jira/secure/attachment/12629768/1329.patch
scott@master:/var/tmp/mahout-0.9$ patch -p0 < 1329.patch
patching file integration/pom.xml
patching file core/pom.xml
patching file math/pom.xml
patching file pom.xml
patching file examples/pom.xml

开始构建

mvn clean package -Dhadoop.profile=200 -Dhadoop.2.version=2.2.0 -Dhbase.version=0.98.0-hadoop2 -DskipTests
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ mahout-math-scala ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /var/tmp/mahout-0.9/math-scala/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ mahout-math-scala ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-scala-plugin:2.15.2:testCompile (default) @ mahout-math-scala ---
[INFO] Checking for multiple versions of scala
[WARNING] Expected all dependencies to require Scala version: 2.9.3
[WARNING] org.apache.mahout:mahout-math-scala:0.9 requires scala version: 2.9.3
[WARNING] org.scalatest:scalatest_2.9.2:1.9.1 requires scala version: 2.9.2
[WARNING] Multiple versions of scala libraries detected!
[INFO] includes = [**/*.scala,**/*.java,]
[INFO] excludes = []
[INFO] /var/tmp/mahout-0.9/math-scala/src/test/scala:-1: info: compiling
[INFO] Compiling 6 source files to /var/tmp/mahout-0.9/math-scala/target/test-classes at 1398704971551
[INFO] prepare-compile in 0 s
[INFO] compile in 22 s
[INFO]
[INFO] --- maven-surefire-plugin:2.16:test (default-test) @ mahout-math-scala ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- scalatest-maven-plugin:1.0-M2:test (test) @ mahout-math-scala ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ mahout-math-scala ---
[INFO] Building jar: /var/tmp/mahout-0.9/math-scala/target/mahout-math-scala-0.9.jar
[INFO]
[INFO] --- maven-jar-plugin:2.4:test-jar (default) @ mahout-math-scala ---
[INFO] Building jar: /var/tmp/mahout-0.9/math-scala/target/mahout-math-scala-0.9-tests.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Mahout Build Tools ................................ SUCCESS [31.056s]
[INFO] Apache Mahout ..................................... SUCCESS [18.776s]
[INFO] Mahout Math ....................................... SUCCESS [1:34.992s]
[INFO] Mahout Core ....................................... SUCCESS [48.791s]
[INFO] Mahout Integration ................................ SUCCESS [1:54.873s]
[INFO] Mahout Examples ................................... SUCCESS [25.467s]
[INFO] Mahout Release Package ............................ SUCCESS [0.020s]
[INFO] Mahout Math/Scala wrappers ........................ SUCCESS [2:32.339s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8:07.680s
[INFO] Finished at: Tue Apr 29 01:09:54 CST 2014
[INFO] Final Memory: 64M/247M
[INFO] ------------------------------------------------------------------------

替换MAHOUT_HOME目录下的jar

用刚编译的jar文件替换MAHOUT_HOME目录下的jar,共6个。

mahout-core-0.9.jar
mahout-core-0.9-job.jar
mahout-examples-0.9.jar
mahout-examples-0.9-job.jar
mahout-integration-0.9.jar
mahout-math-0.9.jar