ivy中文參考文檔(16)-ant任務(wù)(4)-configure
1) configureconfigure任務(wù)用于通過xml設(shè)置文件來配置ivy。
查閱設(shè)置文件來獲取設(shè)置文件自身的細節(jié)。
從2.0起 可以通過sttings聲明來配置ivy。和這個任務(wù)的不同之處在于當(dāng)使用settings聲明時,ivy的配置在settings第一次需要時(例如當(dāng)你做一次resolve)完成,而configure任務(wù)立即執(zhí)行一次配置,這樣如果有某些錯誤發(fā)生可以容易看到。
2) 屬性
屬性 | 描述 | 必要 |
---|---|---|
settingsId | The settings id useable in the
settingsRef attributes of the ivy task that needs a setting. Note that
the ivy tasks will search by default for the settings with the id
"ivy.instance", which is the default value. settings id 用于需要設(shè)置的ivy任務(wù)的 settingsRef屬性中。注意ivy任務(wù)會默認(rèn)搜索id為"ivy.instance"的設(shè)置,這個是默認(rèn)值 |
No, 默認(rèn)為 "ivy.instance" |
file | path to the settings file to use 要使用的設(shè)置文件的路徑 |
No. 如果提供文件,則URL被忽略。如果都沒有提供,則試圖查找${ivy.settings.file}文件,而如果這個文件也沒有,則使用default默認(rèn)設(shè)置文件 |
url | url of the settings file to use 要使用的設(shè)置文件的URL |
|
override | Specify what to do when another settings with the same id has already been loaded. 指示當(dāng)已經(jīng)裝載一個同樣id的另一個設(shè)置時該怎么做
|
No, 默認(rèn)為 "notallowed" |
host | http authentication host | No, 除非需要http認(rèn)證。 |
realm | http authentication realm | |
username | http authentication user name | |
passwd | http authentication password |
3) HTTP 認(rèn)證
注意:HTTP認(rèn)證只有當(dāng)你的classpath下有commons-httpclient.jar時才能使用。如果任何你在ivy中使用的url(尤其在依賴解析時)需要http證,則你必須提供configure任務(wù)的host,realm,username和passwd屬性。這些設(shè)置將在后面調(diào)用ivy任務(wù)使用。
4) 示例
1. 最簡單的設(shè)置
<ivy:configure />
或者使用${ivy.settings.file}如果它存在,或者使用默認(rèn)設(shè)置文件。
2. 使用文件來配置
<ivy:configure file="myconffile.xml" />
3. 使用url來配置
<ivy:configure url="http://mysite.com/myconffile.xml" />
4. 配置多個需要認(rèn)證的URL
<ivy:configure file="path/to/my/ivysettings.xml">
<credentials host="myhost.com" realm="My Realm" username="myuser" passwd="mypasswd" />
<credentials host="yourhost.com" realm="Your Realm" username="myuser" passwd="myotherpasswd" />
</ivy:configure>
<credentials host="myhost.com" realm="My Realm" username="myuser" passwd="mypasswd" />
<credentials host="yourhost.com" realm="Your Realm" username="myuser" passwd="myotherpasswd" />
</ivy:configure>
posted on 2009-08-04 21:29 sky ao 閱讀(1264) 評論(0) 編輯 收藏 所屬分類: project building