1) post resolve tasks
在ivy中有幾個任務被認為是后解析任務(post resolve task),并相應地共享公用行為和設置。
這些任務是:
* retrieve
* cachefileset
* cachepath
* artifactproperty (since 2.0)
* artifactreport (since 2.0)
所有這些任務都將自動觸發(fā)resolve,如果:
* 在當前構建中沒有任何一個keep屬性設置為true的任務被調用
* 組合和模塊沒有設置
從ivy1.4版本起,有兩種方法可以運行resolve :使用ivy文件,或者使用inline模式。當你使用ivy文件調用resolve時,默認會為后面的后解析任務保持被解析的數(shù)據(jù)。當你運行inline模式的resolve時,默認不保持數(shù)據(jù)。你可以通過設置keep屬性為你想要的值來覆蓋這個行為。
如果你想重用在另外一個構建(或者說不是當前這個)中通過調用resolve而得到的數(shù)據(jù),則你不得不設置組織和模塊屬性。這個僅在從你的最后一次resolve調用后緩存沒有被清理的情況下才能有效工作。在inline調用下這個不能工作,inline必須在同一個構建中完成。
2) 屬性
下面列出的屬性大部分只在resove自動觸發(fā)時可用.
屬性
| 描述 | 必要 |
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 |
當自動解析被觸發(fā)時使用的resolve mode (從2.1版本起)
|
不,默認為使用在設置中設置的resolve mode. |
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繼續(xù)
|
不,默認為true |
validate |
true強制使用ivy.xsd驗證ivy文件,false強制不驗證。
|
不,默認為ivy默認值(在設置中間中配置)
|
refresh |
true強制ivy在這次解析過程中解析動態(tài)版本,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如果一個新的解析被執(zhí)行(從2.0起) |
不,默認為'[org]-[module]'. |
log |
在解析過程中使用的日志設置(從2.0起)
可用選項是:
- default
默認日志設置,所以通常的消息都被輸出到控制臺
- download-only
除下載消息外其他所以通常消息都失效。所有東西都在緩存的解析將不輸入任何消息。
- quiet
所有消息失效,除非發(fā)生錯誤,否則整個解析過程保持安靜。
|
不,默認為 'default'. |
3) 示例
<ivy:cachepath organisation="emma" module="emma" revision="2.0.4217" inline="true" conf="ant" pathid="emma.classpath"/>
<taskdef resource="emma_ant.properties" classpathref="emma.classpath" />
解析版本為2.0.4217的emma 模塊,用對應的制品構造一個ant路徑,然后使用這個路徑定義emma任務。