Ivy no resuelve una dependencia, incapaz de encontrar la causa


Al usar ivy:retrieve, no resuelve la dependencia que debe descargarse. La salida se ve así:

Buildfile: C:\Users\Simon\workspace\apollo\build.xml
init:
resolve:

BUILD FAILED
C:\Users\Simon\workspace\apollo\build.xml:42: Problem: failed to create task or type antlib:org.apache.ivy.ant:retrieve
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:
        -C:\Users\Simon\eclipse\plugins\org.apache.ant_1.8.2.v20120109-1030\lib
        -C:\Users\Simon\.ant\lib
        -a directory added on the command line with the -lib argument


Total time: 348 milliseconds

La sección relevante de la build.xml se ve así:

  <target name="resolve" depends="init">
    <ivy:retrieve pattern="${lib}/[artifact]-[revision].[ext]" sync="true" />
  </target>

Aquí también hay una lista de lo que debería estar descargando (desde el build.xml)

  <target name="doc" depends="build">
    <javadoc sourcepath="${src}" classpathref="libraries" access="private" destdir="${doc}" windowtitle="Apollo">
      <doclet name="org.jboss.apiviz.APIviz" pathref="libraries">
        <param name="-sourceclasspath" value="${bin}" />
        <param name="-author" />
        <param name="-version" />
        <param name="-use" />
        <param name="-nopackagediagram" />
      </doclet>
      <doctitle><![CDATA[<h1>Apollo</h1>]]></doctitle>
      <link href="http://download.oracle.com/javase/6/docs/api/" />
      <link href="http://docs.jboss.org/netty/3.2/api/" />
      <link href="http://guava-libraries.googlecode.com/svn/trunk/javadoc/" />
      <link href="http://www.junit.org/apidocs/" />
      <link href="http://commons.apache.org/compress/apidocs/" />
      <link href="http://jruby.org/apidocs/" />
    </javadoc>
  </target>
Author: nbrooks, 2012-03-24

5 answers

ANT no puede encontrar el frasco de hiedra. Necesita ser descargado , extraído, y el ivy-x.y.z.jar colocado en una de las siguientes ubicaciones:

  • ANT ANT_HOME / lib
  • HOME INICIO/.ant / lib

Habilitando a ivy

Ivy está empaquetado como un antlib , por lo que para habilitarlo debe hacer lo siguiente

1) Declare el espacio de nombres ivy en la parte superior del archivo de compilación

<project ..... xmlns:ivy="antlib:org.apache.ivy.ant">

2) Incluir el frasco de hiedra en uno de los directorios de la biblioteca ant

Su mensaje de error indica algunas de las posibles ubicaciones para antlibs:

This appears to be an antlib declaration. 
Action: Check that the implementing library exists in one of:
        -C:\Users\Simon\eclipse\plugins\org.apache.ant_1.8.2.v20120109-1030\lib
        -C:\Users\Simon\.ant\lib
        -a directory added on the command line with the -lib argument

Nota:

La belleza de un antlib es que no necesita realizar el taskdef (es opcional si desea colocar el frasco de hiedra en una ubicación no estándar)

Cómo arrancar una compilación

Aunque ivy es un subproyecto de HORMIGA, por alguna razón inexplicable ivy no está empaquetado con ANT....

Normalmente incluyo el siguiente destino en mis archivos de compilación para configurar un nuevo medio ambiente:

<target name="bootstrap" description="Used to install the ivy task jar">
    <mkdir dir="${user.home}/.ant/lib"/>
    <get dest="${user.home}/.ant/lib/ivy.jar" src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.2.0/ivy-2.2.0.jar"/>
</target>

Descarga el frasco de hiedra de Maven Central.

Dado que todas las demás tareas ANT se pueden descargar posteriormente usando ivy, pocas personas se oponen a esta pequeña pieza de fealdad en la parte superior del archivo de compilación.

 49
Author: Mark O'Connor,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-01-23 00:54:40

Si no puedes poner las ivy libs en el classpath de ant tendrás que definirlo tú mismo:

<path id="ivy.lib.path">
    <fileset dir="path/to/dir/with/ivy/jar" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
         uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>

Este bit falta en el tutorial de introducción, pero aparece aquí: http://ant.apache.org/ivy/history/2.2.0/ant.html

 11
Author: oers,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-03-25 09:02:47

Cuando ejecute la tarea Ant, en el classpath asegúrese de que ivy.jar está ahí. En la pestaña eclipse - > Ejecutar como - > Ant Build - > Editar configuración - > Classpath. Aunque Eclipse tendría la hiedra.tarro en la Casa de HORMIGAS, por alguna razón no se llama.

 4
Author: Smart Coder,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-12-02 17:30:19

Tuve un problema similar en MacOSX (10.11.6 El Capitan). He instalado ant y Ivy con el Cerveza gestor de paquetes.

Una forma adicional es definirlo manualmente usando la opción-lib, por ejemplo:

ant clean compile -lib /usr/local/Cellar/ivy/2.4.0/libexec/ivy-2.4.0.jar 
 0
Author: Christoph,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-12-27 21:19:08

Incluso después de agregar ivy jar al ant lib, no estaba siendo recogido. Seleccionar ANT_HOME de nuevo en Preferences->Ant->Runtime hará que lib dir se actualice, y que se tomen todas las bibliotecas que haya agregado allí.

 0
Author: manojmo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-02-14 10:43:05