WEB开发网
开发学院软件开发Java ivy教程(6)-项目依赖 阅读

ivy教程(6)-项目依赖

 2009-10-08 00:00:00 来源:WEB开发网   
核心提示: 好,现在我们的仓库包含了dependee项目的2个版本,ivy教程(6)-项目依赖(6),其他项目可以关联到任何版本,I:\dependee>dir..\settings\repository/w[.][..]dependee-1.jardependee-1.xmldependee-2.j

好,现在我们的仓库包含了dependee项目的2个版本,其他项目可以关联到任何版本。

I:\dependee>dir ..\settings\repository /w
[.]                [..]               dependee-1.jar   dependee-1.xml   dependee-2.jar   dependee-2.xml
I:\dependee>

step 6: 在depender项目中获取新版本

再次运行depender项目时我们会期望什么?有两个主要事情:

* 获得项目dependee的版本2作为latest.integration 版本

* 运行测试必须显示项目dependee的版本为2

让我们试试吧!

I:\depender>ant
Buildfile: src\example\dependence\depending\build.xml
clean:
   [delete] Deleting 3 files from C:\dev\data\opensource_workspace\ivy\src\example\dependence\depending
   [delete] Deleted 4 directories from C:\dev\data\opensource_workspace\ivy\src\example\dependence\depending
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\dependence\config\ivysettings.xml
[ivy:retrieve] :: resolving dependencies :: [ org.apache | depending | working@BEN-ScokartG ]
[ivy:retrieve]     confs: [default]
[ivy:retrieve]     found [ org.apache | standalone | 2 ] in projects
[ivy:retrieve]     [2] [ org.apache | standalone | latest.integration ]
[ivy:retrieve]     found [ commons-lang | commons-lang | 2.0 ] in libraries
[ivy:retrieve] downloading C:\dev\data\opensource_workspace\ivy\src\example\dependence\config\repository\standalone-2.jar ...
[ivy:retrieve] .. (1kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]     [SUCCESSFUL ] [ org.apache | standalone | 2 ]/standalone.jar[jar] (100ms)
[ivy:retrieve] :: resolution report ::
    ---------------------------------------------------------------------
    |                  |            modules            ||   artifacts   |
    |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
    ---------------------------------------------------------------------
    |      default     |   2   |   1   |   0   |   0   ||   2   |   1   |
    ---------------------------------------------------------------------
[ivy:retrieve] :: retrieving :: [ org.apache | depending ]
[ivy:retrieve]     confs: [default]
[ivy:retrieve]     2 artifacts copied, 0 already retrieved
compile:
    [mkdir] Created dir: C:\dev\data\opensource_workspace\ivy\src\example\dependence\depending\build\classes
    [javac] Compiling 1 source file to C:\dev\data\opensource_workspace\ivy\src\example\dependence\depending\build\classes
run:
     [java] you are using version 2 of class standalone.Main
     [java] standard message : i am depending.Main and standalone.Main will do the job for me
     [java]     [standalone.Main] capitalizing string "i am depending.Main and standalone.Main will do the job for me" using org.apache.commons.lang.WordUtils
     [java] capitalized message : I Am Depending.main And Standalone.main Will Do The Job For Me
BUILD SUCCESSFUL
Total time: 5 seconds

很好,我们得到了期望的结果,run target展示我们正在使用项目dependee的main类的版本2.如果我们看一下resolve target的结果,我们可以看到一个制品从ivy缓存中被下载。实际上这个文件就是从仓库中得到的项目dependee的版本2,你现在可以在ivy- cache目录中得到它。

上一页  1 2 3 4 5 6 

Tags:ivy 教程 项目

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接