ivy中文參考文檔(16)-ant任務(4)-configure
1) configureconfigure任務用于通過xml設置文件來配置ivy。
查閱設置文件來獲取設置文件自身的細節。
從2.0起 可以通過sttings聲明來配置ivy。和這個任務的不同之處在于當使用settings聲明時,ivy的配置在settings第一次需要時(例如當你做一次resolve)完成,而configure任務立即執行一次配置,這樣如果有某些錯誤發生可以容易看到。
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 用于需要設置的ivy任務的 settingsRef屬性中。注意ivy任務會默認搜索id為"ivy.instance"的設置,這個是默認值 |
No, 默認為 "ivy.instance" |
file | path to the settings file to use 要使用的設置文件的路徑 |
No. 如果提供文件,則URL被忽略。如果都沒有提供,則試圖查找${ivy.settings.file}文件,而如果這個文件也沒有,則使用default默認設置文件 |
url | url of the settings file to use 要使用的設置文件的URL |
|
override | Specify what to do when another settings with the same id has already been loaded. 指示當已經裝載一個同樣id的另一個設置時該怎么做
|
No, 默認為 "notallowed" |
host | http authentication host | No, 除非需要http認證。 |
realm | http authentication realm | |
username | http authentication user name | |
passwd | http authentication password |
3) HTTP 認證
注意:HTTP認證只有當你的classpath下有commons-httpclient.jar時才能使用。如果任何你在ivy中使用的url(尤其在依賴解析時)需要http證,則你必須提供configure任務的host,realm,username和passwd屬性。這些設置將在后面調用ivy任務使用。
4) 示例
1. 最簡單的設置
<ivy:configure />
或者使用${ivy.settings.file}如果它存在,或者使用默認設置文件。
2. 使用文件來配置
<ivy:configure file="myconffile.xml" />
3. 使用url來配置
<ivy:configure url="http://mysite.com/myconffile.xml" />
4. 配置多個需要認證的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 閱讀(1260) 評論(0) 編輯 收藏 所屬分類: project building