thể trùng lặp:
Ivy fails to resolve a dependancy, unable to find causeKhông đạt được mục tiêu Ant: Vấn đề Antlib hoặc Ivy?
Tôi đang cố gắng để chạy các nhiệm vụ sau xây dựng (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>
Khi tôi chạy ant -buildfile build.xml initIvy
tôi nhận được kết quả như sau :
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
Khi tôi đi đến $ {ANT_HOME}/lib, tôi không thấy bất kỳ JAR nào có nhãn "antlib * .jar".
Vì vậy, tôi là đoán Tôi đã tải xuống phiên bản Ant không bao gồm Antlib và giờ tôi đang sử dụng Ivy (sử dụng Antlib), bản dựng đang bị nghẹn?
Nếu đây là vấn đề về Antlib, thì tôi tin rằng tôi muốn một trong các bản phân phối có sẵn here. Nếu có, ai đó có thể xác nhận cái nào tôi nên sử dụng (chỉ chứa Antlib và không có gì khác), và xác nhận quá trình cài đặt nó; tức là, nó đơn giản như đưa JAR chính xác vào $ {ANT_HOME}/lib? Vv
Nếu đây là vấn đề của Ivy, thì ai đó có thể chỉ cho tôi đúng hướng như những gì có thể xảy ra?
Và nếu đây không phải là Antlib hoặc Ivy, hãy trả lời câu hỏi trực tiếp ở trên. Cảm ơn trước!
Dang - đúng vậy. Tôi vừa sao chép JAR Ivy lib, quên sao chép Ivy JAR. Chỉ vì tò mò, điều gì đã cho bạn ý tưởng (đúng)? Chỉ cần cố gắng để tìm hiểu vì vậy thời gian tới tôi có thể chẩn đoán vấn đề bản thân mình! Cảm ơn một lần nữa! – IAmYourFaja
@ 4herpsand7derpsago [antlib] (https://ant.apache.org/manual/Types/antlib.html) là một thuật ngữ chung trong kiến và không phải là một công cụ riêng biệt. Nếu bạn nhận được "Không thể tải các định nghĩa từ tài nguyên org/apache/ivy/ant/antlib.xml. Không thể tìm thấy" "thì điều đó có nghĩa là, không có tệp jar trong đường dẫn lớp, chứa và" tổ chức /apache/ivy/ant/antlib.xml "Và vì tệp này là một phần của ivy.xml, bạn biết rằng thiếu lib. – oers
Một cách thuận tiện hơn là sử dụng [Trang web cập nhật của Ivy Eclipse] (http://www.apache.org/dist/ant/ivyde/updatesite) - Cài đặt cả "Apache Ivy" -Libs (Apache Ivy và Apache Ivy Ant Taks) – teclis