Hadoop Eclipse 插件编译安装1.2.0

Hadoop eclipse 插件的源代码位于$HADOOP_HOME/src/contrib/eclipse-plugin 下面。

如果只想单独编译hadoop 的eclipse 插件那么需要修改该目录下面的build.xml 文件

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="jar">
<property value="${ant.project.name}" />
<property value="${basedir}" />
<property location="K:/hadoop/run/hadoop-1.2.0" />
<property value='1.2.0' />
<property location='K:/OpenSource/eclipse' />
<property location="${hadoop.root}/build/contrib/${name}" />
<property location="${build.dir}/classes" />
<property location="${root}/src/java" />


<path>
<fileset dir="${eclipse.home}/plugins/">
<include />
<include />
<include />
<include />
<include />
<include />
<include />
<include />
<include />
<include />
</fileset>
</path>
<!-- Override classpath to include Eclipse SDK jars -->
<path>
<fileset dir="${hadoop.root}">
<include />
</fileset>
<path refid="eclipse-sdk-jars" />
</path>


<target>
<mkdir dir="${build.dir}/classes" />
<javac encoding="ISO-8859-1" srcdir="${src.dir}" includes="**/*.java" destdir="${build.classes}" debug="on" deprecation="off">
<classpath refid="classpath" />
</javac>
</target>
<!-- Override jar target to specify manifest-->
<target depends="compile">
<mkdir dir="${build.dir}/lib" />
<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" />
<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>
</project>

注意修改hadoop,eclipse安装变量

同时修改 MANIFEST.MF文件

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: MapReduce Tools for Eclipse
Bundle-SymbolicName: org.apache.hadoop.eclipse;singleton:=true
Bundle-Version: 0.18
Bundle-Activator: org.apache.hadoop.eclipse.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
 org.eclipse.core.runtime,
 org.eclipse.jdt.launching,
 org.eclipse.debug.core,
 org.eclipse.jdt,
 org.eclipse.jdt.core,
 org.eclipse.core.resources,
 org.eclipse.ui.ide,
 org.eclipse.jdt.ui,
 org.eclipse.debug.ui,
 org.eclipse.jdt.debug.ui,
 org.eclipse.core.expressions,
 org.eclipse.ui.cheatsheets,
 org.eclipse.ui.console,
 org.eclipse.ui.navigator,
 org.eclipse.core.filesystem,
 org.apache.commons.logging
Eclipse-LazyStart: true
Bundle-ClassPath: classes/,lib/hadoop-core.jar,lib/jackson-core-asl-1.8.8.jar ,lib/jackson-mapper-asl-1.8.8.jar, lib/commons-configuration-1.6.jar,lib/commons-lang-2.4.jar, lib/commons-httpclient-3.0.1.jar,lib/commons-cli-1.2.jar
Bundle-Vendor: Apache Hadoop

然后ant jar

编译后的文件位于:$HADOOP_HOME/build/contrib/eclipse-plugin 下面

将编译后的hadoop-eclipse-plugin-1.2.0.jar 文件,复制到eclipse 的 plugins 下面即可。

相关阅读:

Hadoop部署在RedHat Linux 5上常见错误及解决方案

Ubuntu 13.04上搭建Hadoop环境

Hadoop+ZooKeeper+HBase集群配置  

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

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