2010-10-25 85 views
22

我試圖將軟件安裝到我的Debian Lenny服務器上。具體來說,Capture-HPC。我已經安裝了VMWare服務器以及所有先決條件。當我去到目錄中運行ant,我得到以下錯誤:ANT問題:net/sf/antcontrib/antcontrib.properties

[taskdef] Could not load definitions from resource net/sf/antcontrib/antcontrib.properties. It could not be found. 

任何人有什麼原因造成這種任何想法?關於我的螞蟻安裝的詳細信息如下:

Apache Ant version 1.7.0 compiled on April 29 2008 
Buildfile: build.xml 
Detected Java version: 1.6 in: /usr/lib/jvm/java-6-sun-1.6.0.20/jre 
Detected OS: Linux 

和build.xml文件。 。 。

<?xml version="1.0"?> 
<project name="CaptureServer" xmlns:ac="antlib:net.sf.antcontrib" default="release" basedir="."> 
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/> 

<condition property="os" value="unix"> 
    <os family="unix"/> 
</condition> 
<condition property="os" value="windows"> 
    <os family="windows"/> 
</condition> 

<property environment="env"/> 
<property name="src" value="."/> 
<property name="build" value="build"/> 
<property name="lib" value="lib"/> 
<property name="release" value="release"/> 
<property name="classpath.build" value=".\lib\junit-4.4.jar"/> 
<property name="classpath.run" value="lib/junit-4.4.jar"/> 


<path id="classpath"> 
    <fileset dir="${lib}"> 
     <include name="*.jar"/> 
    </fileset> 
</path> 

<target name="init"> 
     <mkdir dir="${build}"/> 
     <mkdir dir="${release}"/> 
</target> 

<target name="compile" depends="init"> 
     <!-- Compile the java code -->   
     <javac srcdir="${src}" destdir="${build}" debug="true" debuglevel="lines,vars,source" classpath="${classpath.build}"/> 

     <!-- Compile the revert code --> 
     <if> 
     <equals arg1="${os}" arg2="windows" /> 
     <then> 
     <exec executable="compile_revert_win32.bat"/> 
     </then> 
     <else> 
     <exec command="sh" executable="./compile_revert_linux.sh"/> 
     </else> 
    </if> 

</target> 

<target name="jar" depends="compile"> 
    <mkdir dir="${build}/jar"/> 
    <jar destfile="${build}/jar/CaptureServer.jar" basedir="${build}"> 
     <manifest> 
      <attribute name="Class-Path" value="${classpath.run}"/> 
      <attribute name="Main-Class" value="capture.Server"/> 
     </manifest> 
    </jar> 
</target> 

<target name="release" depends="clean,compile,jar"> 
    <copy file="${build}/jar/CaptureServer.jar" todir="${release}"/> 
    <copy file="./COPYING" todir="${release}"/> 
    <copy file="./Readme.txt" todir="${release}"/> 
    <copy file="./preprocessor_README.txt" todir="${release}"/> 
    <copy file="./input_urls_example.txt" todir="${release}"/> 
    <copy file="./config.xsd" todir="${release}"/> 
    <copy file="./config.xml" todir="${release}"/> 
    <copy todir="${release}/${lib}"> 
     <fileset dir="lib"/> 
    </copy> 

    <if> 
     <equals arg1="${os}" arg2="windows" /> 
     <then> 
     <copy file="${env.VIX_HOME}/libeay32.dll" todir="${release}"/> 
     <copy file="${env.VIX_HOME}/ssleay32.dll" todir="${release}"/> 
     <copy file="${env.VIX_HOME}/vix.dll" todir="${release}"/> 
     <copy file="./revert.exe" todir="${release}"/> 
     </then> 
     <else> 
     <exec executable="cp"> 
      <arg value="./revert"/> 
      <arg value="${release}"/> 
     </exec> 
     </else> 
    </if> 

    <zip destfile="./CaptureServer-Release.zip" basedir="release"/> 
</target> 

<target name="clean"> 
    <delete dir="${build}"/> 
    <delete dir="${release}"/> 
    <delete> 
     <fileset dir="." includes="revert.exe"/> 
     <fileset dir="." includes="revert"/> 
     <fileset dir="." includes="CaptureServer-Release.zip"/> 
    </delete> 
</target> 
</project> 
+0

後安裝antcontrib你應該使用用於在構建腳本中引用,因爲net/sf/antcontrib/antcontrib.properties僅包含Ant 1.6.x之前的Ant版本的任務。 – Rebse 2012-02-07 21:22:56

回答

27

此錯誤消息表明您正在試圖加載非核心的任務,但它進一步限定該任務的資源不存在(或不在預期的位置)。

請參閱安裝說明here

您可以

  1. 查找/下載ant-contrib罐子,把它放到你的ant安裝(按照選項1上面的鏈接);或
  2. 修改您的ant文件(按照上面鏈接中的選項2),將ant-contrib jar包含在嵌套類路徑中。
+0

已更新。你有螞蟻貢獻罐嗎? – Synesso 2010-10-25 03:51:51

+0

我在哪裏尋找這個?我已經下載了ant-contrib,但似乎無法在下載的文件中找到它。我對螞蟻不熟悉。 – Julio 2010-10-25 04:05:16

+2

您已經下載ant-contrib-1.0b3-bin.zip?在裏面你會發現ant-contrib-1.0b3.jar。忽略其餘的文件。將jar文件放入您的ant安裝目錄中的lib目錄中,然後重試。 – Synesso 2010-10-25 04:09:01

6

解決方案的Linux/Debian的:

apt-get install ant-contrib 
export CLASSPATH=/usr/share/java/ant-contrib.jar 
15

解決方案的Ubuntu:

sudo apt-get install ant-contrib 
sudo ln -s /usr/share/java/ant-contrib.jar /usr/share/ant/lib/ 
2

解決方案爲CentOS/RHEL:

須藤yum的安裝螞蟻的contrib