Sky's blog

我和我追逐的梦

常用链接

统计

其他链接

友情链接

最新评论

ivy中文参考文档(16)-ant任务(4)-configure

1) configure

    configure任务用于通过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的另一个设置时该怎么做
  • true
  • 当前设置将优先覆盖任何之前定义的使用这个id的设置
  • false
  • 当前设置将不覆盖之前定义的使用这个id的设置
  • notallowed
  • 如果已经有使用这个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>


posted on 2009-08-04 21:29 sky ao 阅读(1236) 评论(0)  编辑  收藏 所属分类: project building


只有注册用户登录后才能发表评论。


网站导航: