jackson..
jackson..
4、修改build.xml配置文件
因为没有编译过整个Hadoop项目,所以Hadoop安装目录下的build目录中没有所需的jar文件。因此要手工修改编译所涉及的jar文件为Hadoop安装目录及其lib子目录下中的一共7个jar文件
(1)、设置elipse-sdk-jar path中也包含hadoop安装目录的jar文件。
<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>
<!-- 指定使用$HADOOP_HOME总的jar文件 -->
<fileset dir="${hadoop.root}">
<include name="hadoop-*.jar"/>
</fileset>
</path>
(2)、修改copy的jar文件路径
<target name="jar" depends="compile" unless="skip.contrib">
<mkdir dir="${build.dir}/lib"/>
<!-- 设置正确的所有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-${commons-configuration.version}.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/commons-httpclient-${commons-httpclient.version}.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/commons-lang-${commons-lang.version}.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/jackson-core-asl-${jackson-core-asl.version}.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/jackson-mapper-asl-${jackson-mapper-asl.version}.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>
4、修改MANIFEST.MF配置文件。
修改CLASSPATH,注意CLASSPATH中的每项都要以空格+逗号分隔,没有空格会报错。
注意jar文件的版本号,这里以hadoop-1.1.2为例。
Bundle-ClassPath:
classes/,
lib/hadoop-core.jar,
lib/commons-cli-..jar,
lib/commons-configuration-..jar,
lib/commons-httpclient-...jar,
lib/commons-lang-..jar,
lib/jackson-core-asl-...jar,
lib/jackson-mapper-asl-...jar
Bundle-Vendor: Apache Hadoop
这块要注意:
最后我替换使用这个版本的eclipse的jar包,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;bundle-version="3.7.0",
org.eclipse.core.runtime;bundle-version="3.7.0",
org.eclipse.jdt.launching;bundle-version="3.6.1",
org.eclipse.debug.core;bundle-version="3.7.1",
org.eclipse.jdt;bundle-version="3.7.2",
org.eclipse.jdt.core;bundle-version="3.7.3",
org.eclipse.core.resources;bundle-version="3.7.101",
org.eclipse.ui.ide;bundle-version="3.7.0",
org.eclipse.jdt.ui;bundle-version="3.7.2",
org.eclipse.debug.ui;bundle-version="3.7.102",
org.eclipse.jdt.debug.ui;bundle-version="3.6.1",
org.eclipse.core.expressions;bundle-version="3.4.300",
org.eclipse.ui.cheatsheets;bundle-version="3.4.100",
org.eclipse.ui.console;bundle-version="3.5.100",
org.eclipse.ui.navigator;bundle-version="3.5.101",
org.eclipse.core.filesystem;bundle-version="1.3.100",
org.apache.commons.logging;bundle-version="1.0.4"
Eclipse-LazyStart: true
Bundle-ClassPath: classes/,
lib/hadoop-core.jar,
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
Bundle-Vendor: Apache Hadoop
三、使用ANT编译插件
在Powershell中运行一下命令:
四、复制插件到Eclipse插件目录
编译生成的插件在D:\hadoop-1.2.1\build\contrib\eclipse-plugin(Hadoop安装目录的build\contrib\eclipse-plugin目录中)。
只需要将hadoop-eclipse-plugin-*.jar文件拷贝到Eclipse安装目录的plugins文件夹中即可。
重启Eclipse就有Map/Reduce Perspective了。
参考:
http://www.cnblogs.com/han1988/p/3389398.html
http://blog.****.net/reaper1022/article/details/11009797
http://blog.****.net/majian_1987/article/details/23941603
http://blog.163.com/ppy2790@126/blog/static/1032422412013712111316872/
有关hadoop2.5.2eclipse插件编译