基于Hadoop的数据挖掘项目mahout的源码编译
<br /><br />前提: 机器能联网<br />(1) 用SVN下载Mahout最新源码,check out http://svn.apache.org/repos/asf/mahout/trunk<br /> 注: 发行版源码在 http://archive.apache.org/dist/mahout/ 下<br />(2) 下载 maven,这里下载二进制版本的 maven-3.
前提: 机器能联网
(1) 用SVN下载Mahout最新源码,check out http://svn.apache.org/repos/asf/mahout/trunk
注: 发行版源码在 http://archive.apache.org/dist/mahout/ 下
(2) 下载 maven,这里下载二进制版本的 maven-3.0.3,在 http://archive.apache.org/dist/maven/binaries/ 中下载,下载完成后,解压 apache-maven-3.0.3-bin.tar.gz 即可
(3) 安装 JDK,配置环境变量 JAVA_HOME,maven要用到
(4) 测试 mvn
[root@glnode04 mahout-svn]# /local/apache-maven-3.0.3/bin/mvn
mvn mvnDebug mvnyjp
(5) 编译 mahout
查看 mahout 源码
[zhankunlin@IctHTC ~]$ ls mahout-svn
bin core eclipse install.log math pom.xml src utils
buildtools distribution examples LICENSE.txt NOTICE.txt README.txt taste-web
进入源码目录,运行以下命令进行编译安装
[root@glnode04 mahout-svn]# /local/apache-maven-3.0.3/bin/mvn install
maven将使用默认配置文件 pom.xml,编译 core、examples、eclipse、 taste-web、utils等目录下的所有源码并且进行打包,在编译过程中,会自动从网上下载相关依赖包,所以必须保证机器能联网,否则会在编译过程中出现如下错误。
[ERROR] Plugin org.apache.maven.plugins:maven-install-plugin:2.3.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-install-plugin:jar:2.3.1: Could not transfer artifact org.apache.maven.plugins:maven-install-plugin:pom:2.3.1 from/to central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org: Unknown host repo1.maven.org -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
编译完成后再查看相关目录,例如 core、examples、eclipse、 taste-web、utils等,都生成了相关包和文件,主要包含 target 目录。
[zhankunlin@IctHTC ~]$ ls mahout-svn/core/
build input output pom.xml src target testdata
[zhankunlin@IctHTC ~]$ ls mahout-svn/core/target/
antrun/ mahout-core-0.5-SNAPSHOT.jar maven-archiver/
archive-tmp/ mahout-core-0.5-SNAPSHOT-job.jar surefire-reports/
classes/ mahout-core-0.5-SNAPSHOT-sources.jar test-classes/
generated-sources/ mahout-core-0.5-SNAPSHOT-tests.jar
[zhankunlin@IctHTC ~]$ ls mahout-svn/core/target/
antrun classes mahout-core-0.5-SNAPSHOT.jar mahout-core-0.5-SNAPSHOT-sources.jar maven-archiver test-classes
archive-tmp generated-sources mahout-core-0.5-SNAPSHOT-job.jar mahout-core-0.5-SNAPSHOT-tests.jar surefire-reports
[zhankunlin@IctHTC ~]$ ls mahout-svn/examples/target/
antrun classes generated-sources mahout-examples-0.5-SNAPSHOT.jar mahout-examples-0.5-SNAPSHOT-sources.jar surefire-reports
archive-tmp dependency grouplens.jar mahout-examples-0.5-SNAPSHOT-job.jar maven-archiver test-classes
[zhankunlin@IctHTC ~]$
编译之前目录如下:
[zhankunlin@IctHTC mahout-svn-single-compile]$ ls core
pom.xml src
[zhankunlin@IctHTC mahout-svn-single-compile]$ ls examples/
bin build.xml pom.xml src
-----------------------------------------------------------------------------------
附:
独立编译 core 和 examples或者其它项目
分别进入 core 和 examples 目录,
执行命令 /local/apache-maven-3.0.3/bin/mvn compile,/local/apache-maven-3.0.3/bin/mvn install,
这时maven将读取当前目录下的配置文件 pom.xml 进行编译,
(install过程应该包含了compile过程)
更多推荐
所有评论(0)