Ant 目标失败:Antlib 或 Ivy 问题? [英] Ant target failing: Antlib or Ivy issue?

查看:24
本文介绍了Ant 目标失败:Antlib 或 Ivy 问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
Ivy 无法解决依赖关系,无法找到原因

我正在尝试运行以下构建任务 (initIvy):

I'm trying to run the following build task (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 我得到以下输出:

When I run ant -buildfile build.xml initIvy I get the following output:

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.

When I go to ${ANT_HOME}/lib, I don't see any JARs labeled "antlib*.jar".

所以我猜测我下载了一个不包含 Antlib 的 Ant 版本,现在我使用的是 Ivy(它使用 Antlib),构建很卡?

So I'm guessing I downloaded a version of Ant that did not include Antlib, and now that I'm using Ivy (which uses Antlib), the build is choking?

如果这是一个 Antlib 问题,那么我相信我想要一个可用的发行版这里.如果是这样,有人可以确认我应该使用哪一个(仅包含 Antlib 而没有其他任何内容),并确认安装它的过程;即,是否就像将正确的 JAR 放在 ${ANT_HOME}/lib 中一样简单?等

If this is an Antlib issue, then I believe I want one of the distros available here. If so, can someone confirm which one I should use (that only contains Antlib and not anything else), and confirm the process for installing it; i.e., is it just as simple as putting the correct JAR in ${ANT_HOME}/lib? Etc.

如果这是一个常春藤问题,那么有人能指出我可能会发生什么的正确方向吗?

If this is an Ivy issue, then can someone point me in the right direction as to what could be going on?

如果这既不是 Antlib 也不是 Ivy,那么上面的问题也是如此.提前致谢!

And if this is neither Antlib nor Ivy, ditto for the question directly above. Thanks in advance!

推荐答案

我认为您可能缺少 Apache IVY 库.从这里下载 - apache ivy 将 jar 复制到您的 ant lib 目录中.

I think you might be missing Apache IVY library. Download it from here - apache ivy Copy the jar in your ant lib directory.

例如(根据需要更改版本号):

For example (change version numbers as appropriate):

  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.jar复制到C:\Apps\Tools\apache-ant-1.9.7\lib.
  1. Download and install Ant (e.g., C:\Apps\Tools\apache-ant-1.9.7).
  2. Download and extract Ivy (e.g., C:\Users\UserName\Downloads\apache-ivy-2.4.0)
  3. Copy C:\Users\UserName\Downloads\apache-ivy-2.4.0\ivy-2.4.0.jar into C:\Apps\Tools\apache-ant-1.9.7\lib.

Ant 被配置为使用 Ivy.

Ant is configured to use Ivy.

这篇关于Ant 目标失败:Antlib 或 Ivy 问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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