IVY retrieve 任务功能

1) retrieve

    retrieve任务复制解析好的依赖到你的文件系统的任何位置。

    这是一个post resolve任务,带有所有post resolve任务共有的所有的行为和属性。

    从1.4起 这个任务甚至可以根据依赖解析的结果用实际应该存在的东西来同步目标目录。这意味着如果设置sync为"true",ivy不仅将复制必要的文件,而且它还会删除那些不再需要在那里的文件。

    同步实际上是删除root目标目录下不再是retrieve任务必须的所有文件和目录。

    root目标目录是 在目标正则表达式中的标示为第一级别的第一个标记的目录。
    例如:
    pattern: lib/[conf]/[artifact].[ext]
    root: lib

2) 属性

AttributeDescriptionRequired
patternthe pattern to use to copy the dependenciesNo. Defaults to ${ivy.retrieve.pattern}
ivypatternthe pattern to use to copy the ivy files of dependencies since 1.3 No. Dependencies ivy files are not retrieved by default.
confa comma separated list of the configurations to retrieveNo. Defaults to the configurations resolved by the last resolve call, or * if no resolve was explicitly called
synctrue to synchronize the destination, false to just make a copy since 1.4 No. Defaults to false
typecomma separated list of accepted artifact types since 1.4 No. All artifact types are accepted by default.
symlinktrue to create symbolic links, false to copy the artifacts. The destination of the symbolic links depends on the value of the useOrigin attribute (since 2.0) No. Defaults to false
settingsRefA reference to the ivy settings that must be used by this task (since 2.0) No, 'ivy.instance' is taken by default.
logthe log setting to use during the resolve and retrieve process. (since 2.0)
Available options are the same as for resolve when used to trigger resolve automatically (see postresolvetask), or the following for the retrieve process only:
  • default the default log settings, where all usual messages are output to the console
  • quiet disable all usual messages, making the whole retrieve process quiet unless errors occur
No, defaults to 'default'.



3) 示例

1.

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> < ivy:retrieve  />

    使用默认参数获取依赖。这通常获取最后一次解析调用的所有依赖到lib目录中。

2.

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> < ivy:retrieve  pattern ="${lib.dir}/[conf]/[artifact].[ext]" />

    获取最后一次解析调用的所有依赖到lib目录中,依赖将分隔在按照组织命名的目录中,每个conf目录包含对应的不带修订版本的制品。

    例如,如果ivy文件声明了两个配置default和test,结果lib目录将会像这样:

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> lib
  default
    commons-lang.jar
    commons-logging.jar
  test
    junit.jar

    注意如果一个依赖被两个配置要求,它将被复制到两个目录中。这个依赖的下载将只在resolve的时候进行一次。

3.

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> < ivy:retrieve  pattern ="${lib.dir}/[conf]/[artifact].[ext]"  sync ="true"   />

    和前面相同,但是开启同步。

    例如,如果ivy文件声明了两个配置default和test,结果lib目录将会像这样:

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> lib
  default
    commons-lang.jar
    commons-logging.jar
  test
    junit.jar

    现在假设commons-logging 不再是默认配置的一部分,然后新的retrieve调用将会产生如下结果:

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> lib
  default
    commons-lang.jar
  test
    junit.jar

    如果不开启同步,commons-logging将不会被这次调用删除。

4.

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> < ivy:retrieve  pattern ="${lib.dir}/[type]/[artifact]-[revision].[ext]"  conf ="runtime" />


    仅仅获取配置runtime依赖到用制品类型命名的目录中。结果lib目录将类似这样:

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> lib
  jar
    commons-lang-1.0.jar
    looks-1.1.jar
  source
    looks-1.1.zip


5.

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> < ivy:retrieve  organisation ="foo"  module ="bar"  inline ="true"  pattern ="${my.install.dir}/[artifact].[ext]" />


    解析并获取模块bar和它的依赖的最新版本到${my.install.dir}指出的目录。

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值