27

重複の可能性:
Ivy が依存関係の解決に失敗し、原因が見つからない

次のビルド タスクを実行しようとしています ( 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 を使用する) Ivy を使用しているのに、ビルドが詰まるのですか?

これが Antlib の問題である場合は、ここで入手できるディストリビューションの 1 つが必要だと思います。もしそうなら、誰かが私が使用すべきもの(Antlibのみを含み、他には何も含まないもの)を確認し、それをインストールするプロセスを確認できますか; つまり、正しい JAR を ${ANT_HOME}/lib に置くだけでよいのでしょうか? 等。

これがアイビーの問題である場合、何が起こっているのかについて誰かが正しい方向に私を向けることができますか?

これが Antlib でも Ivy でもない場合は、上記の質問と同じです。前もって感謝します!

4

1 に答える 1

66

ApacheIVYライブラリが不足している可能性があると思います。ここからダウンロードしてください-apacheivyantlibディレクトリにjarをコピーします。

例(必要に応じてバージョン番号を変更):

  1. Antをダウンロードしてインストールします(例:)C:\Apps\Tools\apache-ant-1.9.7
  2. Ivyをダウンロードして抽出します(例C:\Users\UserName\Downloads\apache-ivy-2.4.0:)
  3. にコピーC:\Users\UserName\Downloads\apache-ivy-2.4.0\ivy-2.4.0.jarC:\Apps\Tools\apache-ant-1.9.7\libます。

AntはIvyを使用するように構成されています。

于 2012-10-01T17:14:31.627 に答える