1) retrieve
retrieve任务复制解析好的依赖到你的文件系统的任何位置。
这是一个post resolve任务,带有所有post resolve任务共有的所有的行为和属性。
从1.4起 这个任务甚至可以根据依赖解析的结果用实际应该存在的东西来同步目标目录。这意味着如果设置sync为"true",ivy不仅将复制必要的文件,而且它还会删除那些不再需要在那里的文件。
同步实际上是删除root目标目录下不再是retrieve任务必须的所有文件和目录。
root目标目录是 在目标正则表达式中的标示为第一级别的第一个标记的目录。
例如:
pattern: lib/[conf]/[artifact].[ext]
root: lib
2) 属性
| Attribute | Description | Required |
|---|---|---|
| pattern | the pattern to use to copy the dependencies | No. Defaults to ${ivy.retrieve.pattern} |
| ivypattern | the pattern to use to copy the ivy files of dependencies since 1.3 | No. Dependencies ivy files are not retrieved by default. |
| conf | a comma separated list of the configurations to retrieve | No. Defaults to the configurations resolved by the last resolve call, or * if no resolve was explicitly called |
| sync | true to synchronize the destination, false to just make a copy since 1.4 | No. Defaults to false |
| type | comma separated list of accepted artifact types since 1.4 | No. All artifact types are accepted by default. |
| symlink | true 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 |
| settingsRef | A reference to the ivy settings that must be used by this task (since 2.0) | No, 'ivy.instance' is taken by default. |
| log | the 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:
| No, defaults to 'default'. |
3) 示例
1.
使用默认参数获取依赖。这通常获取最后一次解析调用的所有依赖到lib目录中。
2.
获取最后一次解析调用的所有依赖到lib目录中,依赖将分隔在按照组织命名的目录中,每个conf目录包含对应的不带修订版本的制品。
例如,如果ivy文件声明了两个配置default和test,结果lib目录将会像这样:
default
commons-lang.jar
commons-logging.jar
test
junit.jar
注意如果一个依赖被两个配置要求,它将被复制到两个目录中。这个依赖的下载将只在resolve的时候进行一次。
3.
和前面相同,但是开启同步。
例如,如果ivy文件声明了两个配置default和test,结果lib目录将会像这样:
default
commons-lang.jar
commons-logging.jar
test
junit.jar
现在假设commons-logging 不再是默认配置的一部分,然后新的retrieve调用将会产生如下结果:
default
commons-lang.jar
test
junit.jar
如果不开启同步,commons-logging将不会被这次调用删除。
4.
仅仅获取配置runtime依赖到用制品类型命名的目录中。结果lib目录将类似这样:
jar
commons-lang-1.0.jar
looks-1.1.jar
source
looks-1.1.zip
5.
解析并获取模块bar和它的依赖的最新版本到${my.install.dir}指出的目录。
2万+

被折叠的 条评论
为什么被折叠?



