使用ant制作hadoop1.1.2的eclipse插件(转载)
转自http://www.oschina.net/question/256028_110890
1. 修改%hadoop%\src\contrib\build-contrib.xml文件:
添加hadoop版本和eclipse安装根目录:
<property name="version" value="1.1.2"/> <property name="eclipse.home" location="%eclipse%"/>
<!-- Override jar target to specify manifest --> <target name="jar" depends="compile" unless="skip.contrib"> <mkdir dir="${build.dir}/lib"/> <!-- 自定义的修改内容:begin --> <!-- <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-1.2.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/jackson-core-asl-1.8.8.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-mapper-asl-1.8.8.jar" todir="${build.dir}/lib" verbose="true"/> <!-- 自定义的修改内容:end --> <jar jarfile="${build.dir}/hadoop-${name}-${version}.jar" manifest="${root}/META-INF/MANIFEST.MF"> <fileset dir="${build.dir}" includes="classes/ lib/"/> <fileset dir="${root}" includes="resources/ plugin.xml"/> </jar> </target>
3.修改${HADOOP_HOME}/src/contrib/eclipse-plugin/META-INF/MANIFEST.MF的Bundle-ClassPath:
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/commons-jackson-core-asl-1.8.8.jar, lib/commons-jackson-mapper-asl-1.8.8.jar
4.编辑{HADOOP_HOME}/build.xml:
1)修改hadoop版本号:
2)取消ivy依赖jar的下载:
5.拷贝${hadoop.root}/ivy/ivy-2.1.0.jar 到 ${ant安装目录}/lib/ 中:
6.开启网络;
7.在${hadoop.root}/src/contrib/eclipse-plugin下执行 ant compile 命令;
8.在${hadoop.root}/build/contrib下生成hadoop-eclipse-plugin-1.1.2.jar