- Apache IVY 教程
- Apache IVY - 主頁
- Apache IVY - 概覽
- Apache IVY - 環境設定
- Apache IVY - 術語
- Apache IVY - 設定檔案
- Apache IVY - Eclipse Ivy 外掛
- ANT Ivy 任務
- Apache IVY - resolve
- Apache IVY - install
- Apache IVY - retrieve
- Apache IVY - cachepath
- Apache IVY - publish
- Apache IVY - info
- 倉庫
- Apache IVY - 解析器
- Apache IVY - 本地倉庫
- Apache IVY - 共享倉庫
- Apache IVY - 公共倉庫
- Apache IVY 有用資源
- Apache IVY - 快速指南
- Apache IVY - 有用資源
- Apache IVY - 討論
Apache IVY - 檢索任務
retrieve 任務用於將依賴關係解析到專案工作區中的指定位置。
讓我們建立 Tester.java、build.xml 和 ivy.xml,如 IVY - 解析任務 章節中所述。
更新 build.xml 以使用 ivy 檢索任務。
build.xml
<project name="test" default="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="resolve" description="resolve dependencies">
<ivy:resolve />
<ivy:retrieve sync="true" type="jar" />
</target>
</project>
以下術語很重要。
sync − sync true 確保 lib 目錄是最新的,並刪除任何額外檔案。
type − type 引導 ivy 只複製指定型別的工件,如 jar。源 jar、javadoc jar 將被忽略。源 jar 的型別是 src 或 source,javadoc jar 的型別是 doc 或 bundle。
retrieve 任務預設情況下將已解析的依賴關係複製到專案的 lib 目錄中,並可以使用 pattern 屬性對其進行更改。
構建專案
當我們準備好了所有檔案。只要進入控制檯。導航到 E: > ivy 資料夾並執行 ant 命令。
E:\ivy > ant
Ivy 將開始執行,解析依賴關係,您將看到以下結果。
Buildfile: E:\ivy\build.xml
resolve:
[ivy:resolve] :: Apache Ivy 2.5.0 - 20191020104435 :: https://ant.apache.org/ivy
/ ::
[ivy:resolve] :: loading settings :: url = jar:file:/E:/Apache/apache-ant-1.9.14
/lib/ivy-2.5.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
[ivy:resolve] :: resolving dependencies :: com.tutorialspoint#test;working@Acer-
PC
[ivy:resolve] confs: [default]
[ivy:resolve] found commons-lang#commons-lang;2.6 in public
[ivy:resolve] found junit#junit;3.8.1 in public
[ivy:resolve] :: resolution report :: resolve 316ms :: artifacts dl 18ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 2 | 2 | 0 | 0 || 4 | 0 |
---------------------------------------------------------------------
[ivy:retrieve] :: retrieving :: com.tutorialspoint#test [sync]
[ivy:retrieve] confs: [default]
[ivy:retrieve] 0 artifacts copied, 2 already retrieved (0kB/2756ms)
BUILD SUCCESSFUL
Total time: 31 seconds
您可以在專案 lib 目錄中驗證下載的檔案。
廣告