📅  最后修改于: 2020-11-18 08:37:09             🧑  作者: Mango
解析程序用于查找要从中下载库的位置。依赖项解析器还处理常见任务。 Ivy提供两种类型的解析器。
复合-一个使用其他解析器执行其任务的解析器。
标准-解析器执行所需的任务。
下表列出了标准解析器及其用法。
Sr.No. | Name (Type) & Description |
---|---|
1 |
IvyRep (Standard) Locates Ivy files on ivyrep and artifacts on ibiblio. |
2 |
IBiblio (Standard) Locates artifacts on ibiblio. |
3 |
BinTray (Standard) Locates artifacts on bintray. |
4 |
Packager (Standard) Locates Ivy files and packaging instructions via URLs, creates artifacts using instructions. |
5 |
FileSystem (Standard) Locates Ivy files and artifacts on local file system. |
6 |
URL (Standard) Locates Ivy files and artifacts on repositories which can be accessed using URLs. |
7 |
MirroredURL (Standard) Locates Ivy files and artifacts on repositories which can be accessed using URLs from a mirror list. |
8 |
VFS (Standard) Locates Ivy files and artifacts on repositories which can be accessed using Apache Commons VFS. |
9 |
SSH (Standard) Locates Ivy files and artifacts on repositories which can be accessed using SSH. |
10 |
SFTP (Standard) Locates Ivy files and artifacts on repositories which can be accessed using SFTP. |
11 |
Jar (Standard) Locates Ivy files and artifacts on repositories within a jar. |
12 |
Chain (Composite) Delegates the search to a chain of sub resolvers. |
13 |
Dual (Composite) Delegates the search to a one resolver and artifacts to another. |
14 |
OBR (Standard) Resolve modules as OSGi bundles listed by an OSGi obr.xml. |
15 |
Eclipse updatesite (Standard) Resolve modules as OSGi bundles which are hosted on an Eclipse update site. |
16 |
OSGi-agg (Composite) Delegates the search to a chain of sub resolvers supporting OSGi bundles. |
让我们在E:> ivy2文件夹下的新项目中创建Tester.java,build.xml和ivy.xml,类似于IVY-解决任务一章中所述。在E:> ivy2下创建一个设置文件夹。在设置文件夹中创建ivysettings.xml。
build.xml
常春藤
在这里,我们添加了两个依赖关系,一个是commons-lang库,另一个是我们在IVY-发布任务一章中发布的测试。
ivysettings.xml
在这里,我们添加了使用链解析器创建的复合解析器,该解析器具有两个解析器,一个名为库,用于在本地存储库中定位库,另一个名为ibiblio,位于maven公共存储库中。
由于我们已经准备好所有文件。只是去控制台。浏览至E:> ivy2文件夹,然后运行ant命令。
E:\ivy > ant
Ivy将开始行动,解决依赖关系,您将看到以下结果。
Buildfile: E:\ivy2\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 :: org.apache#chained-resolvers;working@
Acer-PC
[ivy:resolve] confs: [default]
[ivy:resolve] found commons-lang#commons-lang;2.6 in public
[ivy:resolve] found com.tutorialspoint#test;1.0 in local
[ivy:resolve] found junit#junit;3.8.1 in public
[ivy:resolve] downloading C:\Users\Acer\.ivy2\local\com.tutorialspoint\test\1.0\
jars\application.jar ...
[ivy:resolve] .. (1kB)
[ivy:resolve] .. (0kB)
[ivy:resolve] [SUCCESSFUL ] com.tutorialspoint#test;1.0!application.jar (13ms)
[ivy:resolve] :: resolution report :: resolve 1085ms :: artifacts dl 22ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 3 | 3 | 1 | 0 || 5 | 1 |
---------------------------------------------------------------------
BUILD SUCCESSFUL
Total time: 9 seconds
在日志中,您可以验证我们是否同时使用了本地存储库解析器和公共存储库解析器。