用Maven构建Hadoop项目(2)

3. Hadoop开发环境介绍

如上图所示我们可以选择在win中开发也可以在linux中开发本地启动Hadoop或者远程调用Hadoop标配的工具都是MavenEclipse

用Maven构建Hadoop项目

Hadoop集群系统环境:

Linux: Oracle linux Enterprise 5.9

Java: 1.6.0_30

Hadoop: hadoop-1.2.1

三节点:

namenode: 10.1.32.91

datanode: 10.1.32.93

datanode: 10.1.32.95

4. Maven构建Hadoop环境

· 1.Maven创建一个标准化的Java项目

· 2.导入项目到eclipse

· 3.增加hadoop依赖,修改pom.xml

· 4.下载依赖

· 5.Hadoop集群环境下载hadoop配置文件

· 6.配置本地host

1). Maven创建一个标准化的Java项目

C:\Users\licz>mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes-DgroupId=org.conan.myhadoop.mr -DartifactId=myHadoop -DpackageName=org.conan.myhadoop.mr-Dversion=1.0-SNAPSHOT -DinteractiveMode=false

[INFO]Scanning for projects...

[INFO]

[INFO]------------------------------------------------------------------------

[INFO]Building Maven Stub Project (No POM) 1

[INFO] ------------------------------------------------------------------------

[INFO]

[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @standalone-pom >>>

[INFO]

[INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) @standalone-pom <<<

[INFO]

[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @standalone-pom ---

[INFO]Generating project in Batch mode

[INFO]No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)

Downloading:

Downloaded:

n-archetype-quickstart/1.0/maven-archetype-quickstart-1.0.jar(5 KB at 4.5 KB/sec)

Downloading:

Downloaded:(703 B at 1.2 KB/sec)

[INFO]----------------------------------------------------------------------------

[INFO]Using following parameters for creating project from Old (1.x)Archetype:maven-archetype-quickstart:1.0

[INFO]----------------------------------------------------------------------------

[INFO]Parameter: groupId, Value: org.conan.myhadoop.mr

[INFO]Parameter: packageName, Value: org.conan.myhadoop.mr

[INFO]Parameter: package, Value: org.conan.myhadoop.mr

[INFO]Parameter: artifactId, Value: myHadoop

[INFO]Parameter: basedir, Value: C:\Users\licz

[INFO]Parameter: version, Value: 1.0-SNAPSHOT

[INFO]project created from Old (1.x) Archetype in dir: C:\Users\licz\myHadoop

[INFO]------------------------------------------------------------------------

[INFO]BUILD SUCCESS

[INFO]------------------------------------------------------------------------

[INFO]Total time: 36.633s

[INFO]Finished at: Thu Jan 16 10:31:44 CST 2014

[INFO]Final Memory: 11M/490M

[INFO]------------------------------------------------------------------------

进入项目,执行mvn命令

C:\Users\licz>cd myHadoop

C:\Users\licz\myHadoop>mvn clean install

……

[INFO]Installing C:\Users\licz\myHadoop\target\myHadoop-1.0-SNAPSHOT.jar to C:\Users\licz\.m2\repository\org\conan\myhadoop\mr\myHadoop\1.0-SNAPSHOT\myHadoop-1.0-SNAPSHOT.jar

[INFO]Installing C:\Users\licz\myHadoop\pom.xml to C:\Users\licz\.m2\repository\org\conan\myhadoop\mr\myHadoop\1.0-SNAPSHOT\myHadoop-1.0-SNAPSHOT.pom

[INFO]------------------------------------------------------------------------

[INFO]BUILD SUCCESS

[INFO]------------------------------------------------------------------------

[INFO]Total time: 2:06.911s

[INFO]Finished at: Thu Jan 16 14:52:00 CST 2014

[INFO]Final Memory: 9M/490M

[INFO]------------------------------------------------------------------------

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/2daf57d97e8e740cf5ef29ddc2c5acd3.html