可能重複:
Ivy fails to resolve a dependancy, unable to find causeAnt目標失敗:Antlib還是常春藤問題?
我試圖運行下面的生成任務(initIvy
):
<?xml version="1.0" encoding="UTF-8"?>
<project name="myproject-build" default="package" basedir=".." xmlns:ivy="antlib:org.apache.ivy.ant">
<property file="build/build.properties"/>
<property environment="env"/>
<!-- Ant library path, including all of its plugins. -->
<path id="ant.lib.path">
<fileset dir="${env.ANT_HOME}/lib" includes="*.jar"/>
</path>
<!-- CONFIGURE IVY -->
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ant.lib.path"/>
<!-- Use Ivy tasks to resolve dependencies into the local Ivy cache. -->
<target name="initIvy">
<!-- Initialize Ivy and connect to host repository. -->
<echo message="Initializing Apache Ivy and connecting to the host repository."/>
<ivy:settings url="${ivy.std.repo.settings.url}" realm="${ivy.std.repo.realm}" username="${ivy.std.repo.username}" passwd="${ivy.std.repo.password}"/>
<!-- Clear/flush the Ivy cache. -->
<echo message="Cleaning the local Ivy cache for the current build."/>
<ivy:cleancache/>
</target>
<!-- Rest of buildfile omitted for brevity. -->
</project>
當我運行ant -buildfile build.xml initIvy
我得到以下輸出:
Buildfile: /<path-to-my-project>/build/build.xml
[taskdef] Could not load definitions from resource org/apache/ivy/ant/antlib.xml. It could not be found.
initIvy:
[echo] Initializing Apache Ivy and connecting to the host repository.
BUILD FAILED
/<path-to-my-project>/build/build.xml:81: Problem: failed to create task or type antlib:org.apache.ivy.ant:settings
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.
No types or tasks have been defined in this namespace yet
This appears to be an antlib declaration.
Action: Check that the implementing library exists in one of:
-/<path-to-my-ANT_HOME>/lib
-/home/myUser/.ant/lib
-a directory added on the command line with the -lib argument
當我轉到$ {ANT_HOME}/lib時,沒有看到任何標有「antlib * .jar」的JAR。
所以我猜測我下載了一個不包含Antlib的Ant的版本,現在我正在使用常春藤(使用Antlib),構建是窒息?
如果這是一個Antlib問題,那麼我相信我想要一個可用的發行版here。如果是這樣,有人可以確認我應該使用哪一個(只包含Antlib而不包含其他任何東西),並確認安裝它的過程;即,將正確的JAR放入$ {ANT_HOME}/lib中一樣簡單?等
如果這是一個常春藤問題,那麼有人可以指出我在正確的方向,可能會發生什麼?
如果這既不是Antlib也不是常春藤,那麼直接上面的問題同樣如此。提前致謝!
當 - 就是這樣。我剛剛複製了Ivy JAR,忘記複製Ivy JAR。出於好奇,這是什麼給了你(右)的想法?只是試圖學習,所以下次我可以自己診斷問題!再次感謝! – IAmYourFaja
@ 4herpsand7derpsago [antlib](https://ant.apache.org/manual/Types/antlib.html)是ant中的通用術語,而不是單獨的工具。如果你得到「無法從資源org/apache/ivy/ant/antlib.xml加載定義,它找不到」 「,那麼它意味着在classpath中沒有jar文件,它包含和」org /apache/ivy/ant/antlib.xml「,並且因爲這個文件是ivy.xml的一部分,所以你知道缺少這個lib。 – oers
更方便的方法是使用[Ivy Eclipse Update Site](http:/ /www.apache.org/dist/ant/ivyde/updatesite) - 安裝「Apache Ivy」-Libs(Apache Ivy和Apache Ivy Ant Taks) – teclis