ivy教程(5)-双重解析器
2009-10-08 00:00:00 来源:WEB开发网step 2 : 清理
在提示符下: ant
这将清理整个项目目录树(已编译的类和获得的libs)和ivy缓存。
你可以再每次你想清理这个例子时做这个事情。
step 3 : 运行项目
进入projuect目录,并简单运行ant
I:\dual\project>ant
Buildfile: src\example\dual\project\build.xml
resolve:
[ivy:retrieve] :: Ivy 2.0.0-beta1-local-20071104204849 - 20071104204849 :: http://ant.apache.org/ivy/ ::
[ivy:retrieve] :: loading settings :: file = C:\dev\data\opensource_workspace\ivy\src\example\dual\config\ivysettings.xml
[ivy:retrieve] :: resolving dependencies :: [ org.apache | hello-ivy | working@BEN-ScokartG ]
[ivy:retrieve] confs: [default]
[ivy:retrieve] found [ commons-httpclient | commons-httpclient | 2.0.2 ] in ivys
[ivy:retrieve] found [ commons-httpclient | commons-logging | 1.0.4 ] in ibiblio
[ivy:retrieve] found [ commons-lang | commons-lang | 2.0 ] in ibiblio
[ivy:retrieve] downloading http://www.ibiblio.org/maven/commons-httpclient/jars/commons-httpclient-2.0.2.jar ...
[ivy:retrieve] ........................................................
[ivy:retrieve] ........................................................
[ivy:retrieve] ............ (220kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve] [SUCCESSFUL ] [ commons-httpclient | commons-httpclient | 2.0.2 ]/commons-httpclient.jar[jar] (11676ms)
[ivy:retrieve] downloading http://www.ibiblio.org/maven/commons-lang/jars/commons-lang-2.0.jar ...
[ivy:retrieve] ........................................................
[ivy:retrieve] ............................ (165kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve] [SUCCESSFUL ] [ commons-lang | commons-lang | 2.0 ]/commons-lang.jar[jar] (7651ms)
[ivy:retrieve] downloading http://www.ibiblio.org/maven/commons-logging/jars/commons-logging-1.0.4.jar ...
[ivy:retrieve] ............................ (37kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve] [SUCCESSFUL ] [ commons-httpclient | commons-logging | 1.0.4 ]/commons-logging.jar[jar] (9724ms)
[ivy:retrieve] :: resolution report ::
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 3 | 3 | 0 | 0 || 3 | 3 |
---------------------------------------------------------------------
[ivy:retrieve] :: retrieving :: [ org.apache | hello-ivy ]
[ivy:retrieve] confs: [default]
[ivy:retrieve] 3 artifacts copied, 0 already retrieved
run:
[mkdir] Created dir: C:\dev\data\opensource_workspace\ivy\src\example\dual\project\build
[javac] Compiling 1 source file to C:\dev\data\opensource_workspace\ivy\src\example\dual\project\build
[java] standard message : hello ivy !
[java] capitalized by org.apache.commons.lang.WordUtils : Hello Ivy !
[java] head status code with httpclient: 200
[java] now check if httpclient dependency on commons-logging has been realized
[java] found logging class in classpath: interface org.apache.commons.logging.Log
BUILD SUCCESSFUL
Total time: 37 seconds
你可以看到,ivy不仅仅下载commons-lang 和commons-httpclient,而且还有commons-logging.实际上,commons-logging是httpclient的依赖,我们可以看到在仓库目录中找到的httpclient 的ivy文件.
<ivy-module version="1.0">
<info
organisation="commons-httpclient"
module="commons-httpclient"
revision="2.0.2"
status="release"
publication="20041010174300"/>
<dependencies>
<dependency org="commons-logging" name="commons-logging" rev="1.0.4" conf="default"/>
</dependencies>
</ivy-module>
想这样每个东西都工作的很好,ivy文件在仓库目录下被找到而制品从ibiblio下载。
这种类型的配置在你不想依赖maven2仓库的metadata或者你想为一些或者全部模块完全利用ivy文件时有用。
有关双重解析器的完整的解析,请查阅对应的参考文档。
更多精彩
赞助商链接