ant编译HadoopEclipsePlugin报错Target在project不存在

错误提示如下:

D:\ProgramFiles\eclipse-hadoop3x-master\src\contrib\eclipse-plugin> ant jar -Dhadoop.version=3.1.3 -Declipse.home=D:\ProgramFiles\eclipse\ -Dhadoop.home=D:\ProgramFiles\hadoop-3.1.3\hadoop-3.1.3\
Buildfile: D:\ProgramFiles\eclipse-hadoop3x-master\src\contrib\eclipse-plugin\build.xml

compile:
     [echo] contrib: eclipse-plugin

jar:

BUILD FAILED
Target "3.1.3" does not exist in the project "eclipse-plugin".

 

但我查看我的目录eclipse-plugin,下面已经生成了hadoop-eclipse-plugin-3.1.3.jar文件。

我的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 -->
  <path id="classpath">
    <pathelement location="${build.classes}"/>
    <!--pathelement location="${hadoop.root}/build/classes"/-->
    <path refid="eclipse-sdk-jars"/>
    <path refid="hadoop-sdk-jars"/>
 
 <!-- new add -->
<fileset dir="${hadoop.root}">
    <include name="**/*.jar" />
</fileset>
 
  </path>
 
  <!-- Skip building if eclipse.home is unset. -->
  <target name="check-contrib" unless="eclipse.home">
    <property name="skip.contrib" value="yes"/>
    <echo message="eclipse.home unset: skipping eclipse plugin"/>
  </target>
 
 <target name="compile"  unless="skip.contrib"> 
<!--<target name="compile" depends="init, ivy-retrieve-common" unless="skip.contrib">-->
    <echo message="contrib: ${name}"/>
    <javac
     encoding="${build.encoding}"
     srcdir="${src.dir}"
     includes="**/*.java"
     destdir="${build.classes}"
     debug="${javac.debug}"
     deprecation="${javac.deprecation}"
     includeantruntime="on">
     <classpath refid="classpath"/>
    </javac>
  </target>
 
  <!-- Override jar target to specify manifest -->
  <target name="jar" depends="compile" unless="skip.contrib">
    <mkdir dir="${build.dir}/lib"/>
    <copy  todir="${build.dir}/lib/" verbose="true">
          <fileset dir="${hadoop.home}/share/hadoop/mapreduce">
           <include name="hadoop*.jar"/>
          </fileset>
    </copy>
    <copy  todir="${build.dir}/lib/" verbose="true">
          <fileset dir="${hadoop.home}/share/hadoop/common">
           <include name="hadoop*.jar"/>
          </fileset>
    </copy>
    <copy  todir="${build.dir}/lib/" verbose="true">
          <fileset dir="${hadoop.home}/share/hadoop/hdfs">
           <include name="hadoop*.jar"/>
          </fileset>
    </copy>
    <copy  todir="${build.dir}/lib/" verbose="true">
          <fileset dir="${hadoop.home}/share/hadoop/yarn">
           <include name="hadoop*.jar"/>
          </fileset>
    </copy>
 
    <copy  todir="${build.dir}/classes" verbose="true">
          <fileset dir="${root}/src/java">
           <include name="*.xml"/>
          </fileset>
    </copy>
 
    <copy file="${hadoop.home}/share/hadoop/common/lib/protobuf-java-${protobuf.version}.jar"  todir="${build.dir}/lib" verbose="true"/>
    <copy file="${hadoop.home}/share/hadoop/common/lib/log4j-${log4j.version}.jar"  todir="${build.dir}/lib" verbose="true"/>
    <copy file="${hadoop.home}/share/hadoop/common/lib/commons-cli-${commons-cli.version}.jar"  todir="${build.dir}/lib" verbose="true"/>
    <copy file="${hadoop.home}/share/hadoop/common/lib/commons-configuration2-2.1.1.jar"  todir="${build.dir}/lib" verbose="true"/>
    <copy file="${hadoop.home}/share/hadoop/common/lib/commons-lang3-3.7.jar"  todir="${build.dir}/lib" verbose="true"/>
    <copy file="${hadoop.home}/share/hadoop/common/lib/commons-collections-${commons-collections.version}.jar"  todir="${build.dir}/lib" verbose="true"/>  
    <copy file="${hadoop.home}/share/hadoop/common/lib/jackson-core-asl-${jackson.version}.jar"  todir="${build.dir}/lib" verbose="true"/>
    <copy file="${hadoop.home}/share/hadoop/common/lib/jackson-mapper-asl-${jackson.version}.jar"  todir="${build.dir}/lib" verbose="true"/>
    <copy file="${hadoop.home}/share/hadoop/common/lib/slf4j-log4j12-${slf4j-log4j12.version}.jar"  todir="${build.dir}/lib" verbose="true"/>
    <copy file="${hadoop.home}/share/hadoop/common/lib/slf4j-api-${slf4j-api.version}.jar"  todir="${build.dir}/lib" verbose="true"/>
    <copy file="${hadoop.home}/share/hadoop/common/lib/guava-${guava.version}.jar"  todir="${build.dir}/lib" verbose="true"/>
    <copy file="${hadoop.home}/share/hadoop/common/lib/hadoop-auth-${hadoop.version}.jar"  todir="${build.dir}/lib" verbose="true"/>
    <copy file="${hadoop.home}/share/hadoop/common/lib/netty-${netty.version}.jar"  todir="${build.dir}/lib" verbose="true"/> 
    <copy file="${hadoop.home}/share/hadoop/common/lib/javax.servlet-api-3.1.0.jar"  todir="${build.dir}/lib" verbose="true"/>  
    <copy file="${hadoop.home}/share/hadoop/common/lib/commons-io-2.5.jar"  todir="${build.dir}/lib" verbose="true"/> 
    <copy file="${hadoop.home}/share/hadoop/common/lib/htrace-core4-${htrace.version}.jar"  todir="${build.dir}/lib" verbose="true"/> 
    <copy file="${hadoop.home}/share/hadoop/common/lib/woodstox-core-5.0.3.jar"  todir="${build.dir}/lib" verbose="true"/> 
    <copy file="${hadoop.home}/share/hadoop/common/lib/stax2-api-3.1.4.jar"  todir="${build.dir}/lib" verbose="true"/> 
 
    <jar
      jarfile="${build.dir}/hadoop-${name}-${hadoop.version}.jar"
      manifest="${root}/META-INF/MANIFEST.MF">
      <manifest>
   <attribute name="Bundle-ClassPath" 
    value="classes/, 
 lib/hadoop-mapreduce-client-core-${hadoop.version}.jar,
 lib/hadoop-mapreduce-client-common-${hadoop.version}.jar,
 lib/hadoop-mapreduce-client-jobclient-${hadoop.version}.jar,
 lib/hadoop-auth-${hadoop.version}.jar,
 lib/hadoop-common-${hadoop.version}.jar,
 lib/hadoop-hdfs-${hadoop.version}.jar,
 lib/protobuf-java-${protobuf.version}.jar,
 lib/log4j-${log4j.version}.jar,
 lib/commons-cli-${commons-cli.version}.jar,
 lib/commons-configuration2-2.1.1.jar,
 lib/commons-httpclient-${commons-httpclient.version}.jar,
 lib/commons-lang3-3.7.jar,  
 lib/commons-collections-${commons-collections.version}.jar,  
 lib/jackson-core-asl-${jackson.version}.jar,
 lib/jackson-mapper-asl-${jackson.version}.jar,
 lib/slf4j-log4j12-${slf4j-log4j12.version}.jar,
 lib/slf4j-api-${slf4j-api.version}.jar,
 lib/guava-${guava.version}.jar,
 lib/hadoop-auth-${hadoop.version}.jar,
 lib/netty-${netty.version}.jar,
 lib/javax.servlet-api-3.1.0.jar,  
 lib/commons-io-2.5.jar,  
 lib/woodstox-core-5.0.3.jar,
 lib/stax2-api-3.1.4.jar"/> 
   </manifest>
      <fileset dir="${build.dir}" includes="classes/ lib/"/>
      <!--fileset dir="${build.dir}" includes="*.xml"/-->
      <fileset dir="${root}" includes="resources/ plugin.xml"/>
    </jar>
  </target>
</project>

build-contrib文件下添加了如下内容:

eclipse.home、hadoop.home、hadoop.version、hadoop.root是我添加的内容

<property name="eclipse.home" location="D:\ProgramFiles\eclipse"/>
  <property name="hadoop.home" location="D:\ProgramFiles\hadoop-3.1.3\hadoop-3.1.3"/>
  <property name="hadoop.version" value="3.1.3"/>
  <property name="name" value="${ant.project.name}"/>
  <property name="root" value="${basedir}"/>
  <!--property name="hadoop.root" location="${root}/../../../"/-->
  <property name="hadoop.root" location="D:\ProgramFiles\eclipse-hadoop3x-master"/>

libraries.properties文件中相应的版本号也都更改了:部分内容如下:

# This is the version of hadoop we are generating
hadoop.version=3.1.3
hadoop-gpl-compression.version=0.1.0

#These are the versions of our dependencies (in alphabetical order)
apacheant.version=1.10.10
ant-task.version=2.0.10

asm.version=3.2
aspectj.version=1.6.5
aspectj.version=1.6.11

checkstyle.version=4.2

commons-cli.version=1.2
commons-codec.version=1.4
commons-collections.version=3.2.2
commons-configuration.version=2.1.1
commons-daemon.version=1.0.13
commons-httpclient.version=3.0.1
commons-lang.version=2.6
commons-logging.version=1.0.4
commons-logging-api.version=1.0.4
commons-math.version=3.11
commons-el.version=1.0
commons-fileupload.version=1.2
commons-io.version=2.1
commons-net.version=3.1
core.version=3.1.1
coreplugin.version=1.3.2

请哪位大咖知道的帮忙看一下,感谢。

追加说明:已经生成的那个hadoop-eclipse-plugin-3.1.3.jar,已经测试了,在eclipse的Open Perspective中可以看到,也可以打开,但是在点击New Hadoop Location时没有反应。但是在新建Project的时候,可以创建MapReduce的Project,但是能不能使用,还不知道,没做测试。