---
title: "ivy中文参考文档(21)-ant任务(9)-post resolve tasks"
author: "skydream"
date: "2009-09-15T14:17:00Z"
tags: ["Ant", "工作"]
slug: "ivy-21-ant-9-post-resolve-tasks"
draft: false
lastmod: "2009-09-16T21:19:20Z"
id: 470017
url: "https://skydream.iteye.com/blog/470017"
---

1\) post resolve tasks

    在ivy中有几个任务被认为是后解析任务(post resolve task)，并相应地共享公用行为和设置。

    这些任务是：

    * retrieve  
    * cachefileset  
    * cachepath  
    * artifactproperty (since 2.0)  
    * artifactreport (since 2.0)

    所有这些任务都将自动触发resolve，如果：

       * 在当前构建中没有任何一个keep属性设置为true的任务被调用  
       * 组合和模块没有设置

    从ivy1.4版本起，有两种方法可以运行resolve ：使用ivy文件，或者使用inline模式。当你使用ivy文件调用resolve时，默认会为后面的后解析任务保持被解析的数据。当你运行inline模式的resolve时，默认不保持数据。你可以通过设置keep属性为你想要的值来覆盖这个行为。

    如果你想重用在另外一个构建(或者说不是当前这个)中通过调用resolve而得到的数据，则你不得不设置组织和模块属性。这个仅在从你的最后一次resolve调用后缓存没有被清理的情况下才能有效工作。在inline调用下这个不能工作，inline必须在同一个构建中完成。

2\) 属性

    下面列出的属性大部分只在resove自动触发时可用.

属性  
描述 必要 conf 用于retriev的逗号分隔的配置列表，或者是 “\*”  
从2.0起可以使用 '\*(public)' or '\*(private)'.注意当inline为true时 '\*'做'\*(public)'理解。 不。默认是最后一次resolve调用使用的设置，或者没有显示调用resolve时是'\*' inline true使用inline模式，false解析ivy文件(从1.4版本起) 不，默认是false organisation 要获取的模块的组织。通常不需要设置，因为默认为最后解析的组织，除了inline模式需要之外。    
 在inline模式下是，其他不是，默认为最后解析的模块的组织。 module 要获取的模块的名称。通常不需要设置，因为默认为最后解析的组织，除了inline模式需要之外。 在inline模式下是，其他不是，默认为最后解析的模块的名称。 revision 要获取的模块的版本约束，仅在inline模式下使用。从1.4版本起。 不，默认为latest.integration branch 在inline模式下要解析的模块的分支(从2.1版本起) 在inline模式下默认没有分支，标准模式下无关。 transitive true递归解析依赖，false不递归，从1.4起  
不，默认为true resolveMode 当自动解析被触发时使用的 [resolve mode](http://ant.apache.org/ivy/history/latest-milestone/use/resolve.html) (从2.1起 )  
不，默认为使用在设置中设置的resolve mode.[](http://ant.apache.org/ivy/history/latest-milestone/settings.html) keep true to keep the results of the automatic resolve in memory, false to discard them. When this is false, the standard ivy properties won't be set and other postresolve-tasks (like retrieve and cachepath) won't be able to resuse the results of this resolve!  
true在内存中保持自动解析的结果，false抛弃结果。当这个是false时，标准ivy属性不会被设置，而其他postresolve-tasks(如retrieve 和 cachepath)将不能重用这次解析的结果！ 不，inline模式默认是false，而其他情况默认为true  
haltonfailure true当ivy失败时挂起构建，false继续  
不，默认为true validate true强制使用ivy.xsd验证ivy文件，false强制不验证。  
不，默认为ivy默认值(在设置中间中配置)  
refresh true强制ivy在这次解析过程中解析动态版本，false使用缓存的解析好的版本。从2.1起  
不，默认为false file 要解析的文件，如果解析式必要的，从2.0起  
不，默认为前面解析的ivy文件或者默认为${ivy.dep.file} settingsRef A reference to the ivy settings that must be used by this task (since 2.0)  
必须被这个任务使用的ivy设置的引用。(从2.0起)  
不，默认使用'ivy.instance' resolveId The id which was used for a previous resolve, or the resolveId if a new resolve is performed (since 2.0)  
之前解析使用过的id，或者 resolveId如果一个新的解析被执行(从2.0起) 不，默认为'\[org]-\[module]'. log 在解析过程中使用的日志设置(从2.0起)  
可用选项是：

- default 默认日志设置，所以通常的消息都被输出到控制台
- download-only 除下载消息外其他所以通常消息都失效。所有东西都在缓存的解析将不输入任何消息。
- quiet 所有消息失效，除非发生错误，否则整个解析过程保持安静。

不，默认为 'default'.

3\) 示例

&lt; ivy:cachepath  organisation ="emma"  module ="emma"  revision ="2.0.4217"  inline ="true"  conf ="ant"  pathid ="emma.classpath" /&gt;  
&lt; taskdef  resource ="emma\_ant.properties"  classpathref ="emma.classpath"   /&gt;

    解析版本为2.0.4217的emma 模块，用对应的制品构造一个ant路径，然后使用这个路径定义emma任务。