Apache Ant Ivy 笔记 (二)

 

Apache Ant Ivy 笔记 (二)

Ref: http://ant.apache.org/ivy/history/latest-milestone/tutorial/start.html

Section: The build.xml file

Tutorials: http://ant.apache.org/ivy/history/latest-milestone/tutorial.html

Ant tasks: http://ant.apache.org/ivy/history/latest-milestone/ant.html

Ant build.xml

要查看ant build文件中的所有target, 只要在命令行下输入"ant -P" 就可以了.

下面是hello-ivy的build.xml片段:

 

< project  xmlns:ivy ="antlib:org.apache.ivy.ant"  name ="hello-ivy"  default ="run" >

...

    
<!--  ================================= 
    target: resolve 
    ================================= 
-->
    
< target  name ="resolve"  description ="--> retrieve dependencies with ivy" >
        
< ivy:retrieve  />
    
</ target >
</ project >

 

可以看到, revole和retrieve dependency很简单, 只要你正确安装Ivy, 然后在build.xml中定义一个namespace, 所有Ivy ant task就全部可用了. 

xmlns:ivy="antlib:org.apache.ivy.ant"


如果没有任何设置, Ivy会从maven2 的repository获取文件. resove task 在maven 2 repository中找到了 commons-lang 和 commons-cli, 并且获知 commons-cli依赖于 commons-logging, 所以也会主动把common-logging下载下来. Ivy默认会先把相应的文件放到它的cache中 (默认是user home/.ivy2/cache目录).

最后, resolve task会将相关的jar文件都copy到项目的library目录 (默认是lib目录, 不过你可以很方便的修改, 只要设置retrieve task的属性).

 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值