常春藤无法解析的依赖,无法找到病因 [英] Ivy fails to resolve a dependency, unable to find cause

查看:546
本文介绍了常春藤无法解析的依赖,无法找到病因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用常春藤:检索,它未能解决应下载的依赖。输出看起来是这样的:

 构建文件:C:\\用户\\西蒙\\工作区\\阿波罗\\ build.xml文件
在里面:
解决:构建失败
C:\\用户\\西蒙\\工作区\\阿波罗\\的build.xml:42:问题:无法创建任务或键入的antlib:org.apache.ivy.ant:检索
原因:这个名字是不确定的。
操作:检查拼写。
操作:检查所有的自定义任务/类型已经被宣布。
操作:检查任何与LT; presetdef> /< macrodef>声明发生。
任何类型或任务已在此命名空间中定义还这似乎是一个的antlib声明。
操作:检查实施库中的一个存在:
        -C:\\用户\\西蒙\\日食\\插件\\ org.apache.ant_1.8.2.v20120109-1030 \\ lib中
        -C:\\用户\\西蒙\\赵军阳张志利\\ lib中
        -a目录加入在命令行上与-lib论点
总时间:348毫秒

的相关部分的的build.xml 看起来像这样:

 <目标名称=解析取决于=初始化>
    <常春藤:检索模式=$ {}的lib / [神器] - [修改] [转]。同步=真/>
  < /目标与GT;

下面也是一个列表什么应该被下载(从的build.xml

 <目标名称=文档依赖=编译>
    < javadoc的源路径=$ {src}字符串classpathref =库访问=私人DESTDIR =$ {} DOCWINDOWTITLE =阿波罗>
      <的doclet NAME =org.jboss.apiviz.APIvizpathref =库>
        < PARAM NAME = - sourceclasspathVALUE =$ {}斌/>
        < PARAM NAME = - 作者/>
        < PARAM NAME = - 版/>
        < PARAM NAME = - 用/>
        < PARAM NAME = - nopackagediagram/>
      < /&doclet的GT;
      &所述; doctitle>&下;![CDATA并[d H1>阿波罗&下; / H1]的计算值]≥&下; / doctitle>
      <链接HREF =htt​​p://download.oracle.com/javase/6/docs/api//>
      <链接HREF =htt​​p://docs.jboss.org/netty/3.2/api//>
      <链接HREF =HTTP://guava-libraries.google$c$c.com/svn/trunk/javadoc//>
      <链接HREF =htt​​p://www.junit.org/apidocs//>
      <链接HREF =htt​​p://commons.apache.org/com$p$pss/apidocs//>
      <链接HREF =htt​​p://jruby.org/apidocs//>
    < / javadoc的>
  < /目标与GT;


解决方案

ANT找不到常春藤罐子。需要下载放入以下位置之一:


  • $ ANT_HOME / lib目录

  • $ HOME /赵军阳张志利/ lib目录

启用常春藤

常春藤打包为的antlib ,所以启用它,你需要做以下

1)
声明常春藤命名空间的构建文件的顶部

 <项目.....的xmlns:常春藤=的antlib:org.apache.ivy.ant>

2)
包括常春藤罐子蚂蚁图书馆目录之一

您的错误消息indictates有的为antlibs可能的位置:

 这似乎是一个的antlib声明。
操作:检查实施库中的一个存在:
        -C:\\用户\\西蒙\\日食\\插件\\ org.apache.ant_1.8.2.v20120109-1030 \\ lib中
        -C:\\用户\\西蒙\\赵军阳张志利\\ lib中
        -a目录加入在命令行上与-lib论点

注意:

一个的antlib的好处是,你(如果你想放置在一个非标准位置常春藤罐子它是可选的)并不需要执行的taskdef

如何引导构建

尽管常春藤是一个ANT子项目,为一些莫名其妙的原因,常春藤不与ANT打包....

我通常包括以下目标在我的构建文件设置一个新的环境:

 <目标名称=引导描述=用于安装常春藤任务罐子>
    < MKDIR DIR =$ {}的user.home /蚂蚁/ lib目录下。/>
    <获得DEST =$ {}的user.home /蚂蚁/ lib目录/ ivy.jarSRC =htt​​p://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.2.0 /ivy-2.2.0.jar\"/>
< /目标与GT;

它从下载中心Maven的常春藤罐子。

由于所有其他Ant任务可随后使用常春藤下载,很少有人反对在构建文件的顶部,这个小片丑。

While using ivy:retrieve, it fails to resolve the dependency that should be downloaded. The output looks like this:

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

The relevant section of the build.xml looks like so:

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

Here is also a list of what it should be downloading (from the 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>

解决方案

ANT cannot find the ivy jar. Needs to be downloaded placed into one of the following locations:

  • $ANT_HOME/lib
  • $HOME/.ant/lib

Enabling ivy

Ivy is packaged as an antlib, so to enable it you need to do the following

1) Declare the ivy namespace at the top of the build file

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

2) Include the ivy jar in one of the ant library directories

Your error message indictates some of the possible locations for 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

Note:

The beauty of an antlib is that you don't need to perform the taskdef (It's optional if you want to place the ivy jar in a non-standard location)

How to bootstrap a build

Even though ivy is an ANT sub-project, for some inexplicable reason ivy is not packaged with ANT....

I normally include the following target in my build files to setup a new environment:

<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>

It downloads the ivy jar from Maven Central.

Since all other ANT tasks can subsequently be downloaded using ivy, few people object to this little piece of ugliness at the top of the build file.

这篇关于常春藤无法解析的依赖,无法找到病因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆