在windows下配置hadoop-eclipse插件,并连接虚拟机的hadoop集群
前提:本地环境java+ant
本编译使用eclipse3.6,一开始用的3.7一致报错,网上找了好久。。。。必须3.6
- 下载hadoop-1.1.2.tar.gz到本地目录
- 使用Git Bash(可模拟部分linux的命令)解压hadoo-1.1.2.tar.gz文件
Git下载路径:https://code.google.com/p/msysgit/downloads/list?q=full+installer+official+git
- 进入${hadoop.home}/src/contrib/eclipse-plugin目录写该build.xml文件
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <project default="jar" name="eclipse-plugin"> <property name="name" value="${ant.project.name}"/> <property name="root" value="${basedir}"/> <property name="hadoop.root" location="d:/hadoop/hadoop-1.1.2"/> <property name='version' value='1.1.2'/> <property name='eclipse.home' location='d:/hadoop/eclipse'/> <property name="build.dir" location="${hadoop.root}/build/contrib/${name}"/> <property name="build.classes" location="${build.dir}/classes"/> <property name="src.dir" location="${root}/src/java"/> <path id="eclipse-sdk-jars"> <fileset dir="${eclipse.home}/plugins/"> <include name="org.eclipse.ui*.jar"/> <include name="org.eclipse.jdt*.jar"/> <include name="org.eclipse.core*.jar"/> <include name="org.eclipse.equinox*.jar"/> <include name="org.eclipse.debug*.jar"/> <include name="org.eclipse.osgi*.jar"/> <include name="org.eclipse.swt*.jar"/> <include name="org.eclipse.jface*.jar"/> <include name="org.eclipse.team.cvs.ssh2*.jar"/> <include name="com.jcraft.jsch*.jar"/> </fileset> </path> <!-- Override classpath to include Eclipse SDK jars --> <path id="classpath"> <fileset dir="${hadoop.root}"> <include name="*.jar"/> </fileset> <path refid="eclipse-sdk-jars"/> </path> <target name="compile"> <mkdir dir="${build.dir}/classes"/> <javac encoding="ISO-8859-1" srcdir="${src.dir}" includes="**/*.java" destdir="${build.classes}" debug="on" includeAntRuntime="false" deprecation="off"> <classpath refid="classpath"/> </javac> </target> <!-- Override jar target to specify manifest--> <target name="jar" depends="compile"> <mkdir dir="${build.dir}/lib"/> <copy file="${hadoop.root}/hadoop-core-${version}.jar" tofile="${build.dir}/lib/hadoop-