配置ant
tar -zxvf apache-ant-1.9.2-bin.tar.gz
export ANT_HOME=/home/hadoop/apache-ant-1.9.2
export PATH=${JAVA_HOME}/bin:${HADOOP_HOME}/bin:${PIG_HOME}/bin:${ANT_HOME}/bin:$PATH
编译生成插件包
1、解压hadoop-1.1.2.tar.gz。如:/home/hadoop/hadoop-1.1.2。
2、进入/home/hadoop/hadoop-1.1.2/src/contrib目录,将build-contrib.xml复制到/home/hadoop/hadoop-1.1.2/src/contrib/eclipse-plugin目录下。
将
<property name="root" value="${basedir}"/>
<property name="hadoop.root" location="${root}/../../../"/>
替换为
<property name="root" value="/home/hadoop/hadoop-1.1.2/src/contrib/eclipse-plugin"/>
<property name="eclipse.home" location="/home/hadoop/eclipse"/>
<property name="version" value="1.1.2"/>
<property name="hadoop.root" location="/home/hadoop/hadoop-1.1.2"/>
3、修改 /home/hadoop/hadoop-1.1.2/src/contrib/eclipse-plugin下的build.xml文件
<import file="../build-contrib.xml"/>
改为
<import file="build-contrib.xml"/>
<pathelement location="${hadoop.root}/build/classes"/>
后插入
<pathelement location="${hadoop.root}/hadoop-core-1.1.2.jar"/>
把
<copy file="${hadoop.root}/build/hadoop-core-${version}.jar" tofile="${build.dir}/lib/hadoop-core.jar" verbose="true"/>
<copy file="${hadoop.root}/build/ivy/lib/Hadoop/common/commons-cli-${commons-cli.version}.jar" todir="${build.dir}/lib" verbose="true"/>
替换为
<copy file="${hadoop.root}/hadoop-core-${version}.jar" tofile="${build.dir}/lib/hadoop-core.jar" verbose="true"/>
<copy file="${hadoop.root}/lib/commons-cli-${commons-cli.version}.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/commons-configuration-1.6.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/commons-httpclient-3.0.1.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/commons-lang-2.4.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/jackson-core-asl-1.8.8.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/jackson-mapper-asl-1.8.8.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/hadoop-core-${version}.jar" tofile="${build.dir}/lib/hadoop-core.jar" verbose="true"/>
<copy file="${hadoop.root}/lib/commons-cli-${commons-cli.version}.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/commons-configuration-1.6.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/commons-httpclient-3.0.1.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/commons-lang-2.4.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/jackson-core-asl-1.8.8.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/jackson-mapper-asl-1.8.8.jar" todir="${build.dir}/lib" verbose="true"/>
4、修改:MANIFEST.MF文件。目录:/home/hadoop/hadoop-1.1.2/src/contrib/eclipse-plugin\META-INF
Bundle-ClassPath那一栏加入如下信息:
Text代码
Bundle-ClassPath: classes/,
lib/hadoop-core.jar,
lib/commons-cli-1.2.jar,
lib/commons-configuration-1.6.jar,
lib/commons-httpclient-3.0.1.jar,
lib/commons-lang-2.4.jar,
lib/jackson-core-asl-1.8.8.jar,
lib/jackson-mapper-asl-1.8.8.jar
5、进入/home/hadoop/hadoop-1.1.2/src/contrib/eclipse-plugin目录,使用Ant进行编译。
6、生成的插件包在/home/hadoop/hadoop-1.1.2/build/contrib/eclipse-plugin目录下,
复制/home/hadoop/hadoop-1.1.2/build/contrib/eclipse-plugin/hadoop-eclipse-plugin-1.1.2.jar 到 eclipse安装目录/plugins/下