环境简介:
- hadoop 2.4.1 运行在linux虚拟机当中(伪分布式,其实这个不影响)
- Eclipse 4.3.2 运行在windows 8.1中
- ant 1.9.4 运行在windows 8.1 中,环境变量已经配置好
利用ant 编译出hadoop2.4.1的Eclipse插件:
因hadoop2.4.1版本比较新,官方并没有提供该版本的Eclipse插件,因此我们需要自行编译出来。
1、在github上下载
hadoop2x-eclipse-plugin,该版本为hadoop2.2.0,不过经过测试2.4.1也一样可以正常运行。解压
2、打开cmd 运行如下命令:
G:\hadoop2x-eclipse-plugin-master\src\contrib\eclipse-plugin>ant jar -Dversion=2
.4.1 -Declipse.home=G:\eclipse-standard-kepler-SR2-win32-x86_64\eclipse -Dhadoop
.home=G:\hadoop-2.4.1
初次运行这个命令会生成一些必要的额目录,但是并不会编译成功。
3、修改hadoop2x-eclipse-plugin-master\src\contrib\eclipse-plugin\下的build.xml :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project default="jar" name="eclipse-plugin">
<import file="../build-contrib.xml"/>
<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>
<path id="hadoop-sdk-jars">
<fileset dir="${hadoop.home}/share/hadoop/mapreduce">
<include name="hadoop*.jar"/>
</fileset>
<fileset dir="${hadoop.home}/share/hadoop/hdfs">
<include name="hadoop*.jar"/>
</fileset>
<fileset dir="${hadoop.home}/share/hadoop/common">
<include name="hadoop*.jar"/>
</fileset>
</path>
<!-- Override classpath to include Eclipse SDK jars --