簡體   English   中英

ant:找不到jar中的資源。 無法創建任務或鍵入類路徑

[英]ant: resource in jar could not be found. failed to create task or type classpath

我在螞蟻中遇到以下問題:

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

BUILD FAILED
build.xml:5: Problem:
failed to create task or type classpath
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.

運行以下螞蟻build.xml:

<?xml version="1.0"?>

<project default="main" basedir=".">    
    <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
    <classpath>
      <fileset dir=".">
        <include name="**/*.jar" />
      </fileset>
    </classpath>

    <target name="main">

    </target >
</project>

雖然,跑步

<project default="main" basedir=".">    

    <path id="path.svnant">
        <pathelement location="${basedir}/ant-contrib-1.0b3.jar" />
    </path>

    <typedef resource="net/sf/antcontrib/antcontrib.properties" classpathref="path.svnant" />

    <target name="main">

    </target >
</project>

結果沒有任何錯誤。

所以問題是為什么第一個build.xml是錯誤的?

我想是因為<classpath/>元素必須在</taskdef>元素內。

<taskdef resource="net/sf/antcontrib/antcontrib.properties" >
   <classpath>
      <fileset dir=".">
         <include name="**/*.jar" />
      </fileset>
   </classpath>
</taskdef>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM