web-dev-qa-db-fra.com

Échec de la cible Ant: problème Antlib ou Ivy?

Duplicata possible:
Ivy ne parvient pas à résoudre une dépendance, impossible de trouver la cause

J'essaie d'exécuter la tâche de génération suivante (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>

Quand je lance ant -buildfile build.xml initIvy J'obtiens la sortie suivante:

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

Lorsque je vais dans $ {ANT_HOME}/lib, je ne vois aucun fichier JAR étiqueté "antlib * .jar".

Donc je suis deviner J'ai téléchargé une version d'Ant qui n'incluait pas Antlib, et maintenant que j'utilise Ivy (qui utilise Antlib), la construction s'étouffe?

S'il s'agit d'un problème Antlib, je pense que je veux une des distributions disponibles ici . Si c'est le cas, quelqu'un peut-il confirmer lequel je dois utiliser (qui ne contient que Antlib et rien d'autre), et confirmer le processus d'installation; c'est-à-dire, est-ce aussi simple que de mettre le JAR correct dans $ {ANT_HOME}/lib? Etc.

S'il s'agit d'un problème lié au lierre, quelqu'un peut-il m'orienter dans la bonne direction quant à ce qui pourrait se passer?

Et si ce n'est ni Antlib ni Ivy, idem pour la question directement ci-dessus. Merci d'avance!

25
IAmYourFaja

Je pense que vous manquez peut-être la bibliothèque Apache IVY. Téléchargez-le à partir d'ici - Apache ivy Copiez le pot dans votre répertoire ant lib.

Par exemple (modifiez les numéros de version selon le cas):

  1. Téléchargez et installez Ant (par exemple, C:\Apps\Tools\Apache-ant-1.9.7).
  2. Téléchargez et extrayez Ivy (par exemple, C:\Users\UserName\Downloads\Apache-ivy-2.4.0)
  3. Copie C:\Users\UserName\Downloads\Apache-ivy-2.4.0\ivy-2.4.0.jar en C:\Apps\Tools\Apache-ant-1.9.7\lib.

Ant est configuré pour utiliser Ivy.

61
Shwetanka