Ant目标失败:的antlib或常春藤问题? [重复](Ant target failing:

2019-08-01 02:02发布

可能重复:
常春藤未能解决扶养,无法找到原因

我试图运行下面的生成任务( 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文件。

所以我我下载了一个版本的Ant,不包括的antlib,现在我使用艾维(使用的antlib),构建窒息?

如果这是一个问题的antlib,那么我相信,我想提供的发行版之一在这里 。 如果是这样,有人可以证实,我应该使用哪一个(只包含的antlib而不是别的什么),并确认安装它的进程; 也就是说,它只是简单的把正确的JAR在$ {ANT_HOME} / lib目录? 等等。

如果这是一个常青藤问题,那么可以有人点我在正确的方向,以什么可以怎么回事?

如果这是没有的antlib也不常青藤,同上直接上面的问题。 提前致谢!

Answer 1:

我想你可能会丢失的Apache IVY库。 从这里下载- 阿帕奇常春藤复制罐子在Ant lib目录。

例如(变化的版本号如适用):

  1. 下载并安装Ant(如C:\Apps\Tools\apache-ant-1.9.7 )。
  2. 下载并解压缩常春藤(如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 target failing: Antlib or Ivy issue? [duplicate]
标签: java ant ivy