| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| <html> |
| <head> |
| <script type="text/javascript">var xookiConfig = {level: 1};</script> |
| <script type="text/javascript" src="../xooki/xooki.js"></script> |
| </head> |
| <body> |
| <textarea id="xooki-source"> |
| <span class="since">(since 2.0)</span> |
| |
| The settings declaration is used to configure ivy with an xml settings file. The difference with the [[ant:configure]] task is that when using the settings declaration, the configuration of Ivy will be done when the settings are first needed (for instance when you do a resolve), while the configure task will perform a configuration of Ivy instantly, which makes it easier to see the problem if something goes wrong. |
| |
| See [[settings]] for details about the settings file itself.<br/><br/> |
| |
| Multiple settings can be defined in a build script. Every task can reference its own settings. |
| |
| All Ivy variables set during the settings are available in the Ant project as long as they were not set in Ant before (Ant properties are immutable). |
| Moreover, the variables are exposed under two names: the variable name, and the variable name suffixed by dot + the settings id. |
| For instance, if you load a settings with the id 'myid', and define a variable my.variable=my.value in the Ivy settings, both my.variable and my.variable.myid will now be available as properties in Ant and equal to 'my.value'. If you later load another settings with the id 'yourid', and in this settings assign the variable 'my.variable' the value 'your.value', in the Ant project you will have: |
| <code> |
| my.variable=my.value |
| my.variable.myid=my.value |
| my.variable.yourid=your.value |
| </code> |
| |
| <h2>Attributes</h2> |
| <table class="ant"> |
| <thead> |
| <tr><th class="ant-att">Attribute</th><th class="ant-desc">Description</th><th class="ant-req">Required</th></tr> |
| </thead> |
| <tbody> |
| <tr><td>id</td><td>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.</td><td>No, defaults to "ivy.instance"</td></tr> |
| <tr><td>file</td><td>path to the settings file to use</td> |
| <td rowspan="2">No. If a file is provided, url is ignored. If none are provided, then it attempts to find a file at ${ivy.settings.file}, and if this file does not exist, it uses a [[tutorial/defaultconf default settings file]]</td></tr> |
| <tr><td>url</td><td>url of the settings file to use</td></tr> |
| <tr><td>host</td><td>http authentication host</td><td rowspan="4">No, unless authentication is required</td></tr> |
| <tr><td>realm</td><td>http authentication realm</td></tr> |
| <tr><td>username</td><td>http authentication user name</td></tr> |
| <tr><td>passwd</td><td>http authentication password</td></tr> |
| </tbody> |
| </table> |
| <h2>HTTP Authentication</h2> |
| <i>Note: HTTP Authentication can be used only if <a href="http://jakarta.apache.org/commons/httpclient/">commons-httpclient.jar</a> is in your classpath</i> |
| If any of the url you use in ivy (especially in dependency resolvers) need http |
| authentication, then you have to provide the host, realm, username and passwd |
| attributes of the configure task. These settings will then be used in any |
| further call to ivy tasks.<br/><br/> |
| |
| <h2>Multiple classloader</h2> |
| A special attention should be applied when you have a multi-project build with <i>subant</i> call, using ivy task loaded by a <i>typedef</i>. Indeed in this situation, it is possible to pass settings reference to a subbuild. When you do that, you should take of the classloader. The ivy task of your subant should not be defined in a different classloader than the parent one. This can be achieved by using the <i>loader</i> parameter of the antlib declaration, or avoid to reload the ivy antlib in the subbuild (place the taskdef in a target only executed when the antlib is not yet loaded).<br/><br/> |
| |
| |
| <h2>Examples</h2> |
| <h3>Simplest settings</h3> |
| <code><ivy:settings /></code> |
| Use either ${ivy.settings.file} if it exists, or the <a href="../samples/ivysettings-default.xml">default settings file</a><br> |
| This simplest setting is implicit. |
| <h3>Configure with a file</h3> |
| <code><ivy:settings file="mysettings.xml" /></code> |
| <h3>Configure with an url</h3> |
| <code><ivy:settings url="http://mysite.com/mysettings.xml" /></code> |
| <h3>Configure multiple realms which require autentication</h3> |
| <code> |
| <ivy:settings 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:settings> |
| </code> |
| <h3>Configure 2 different settings</h3> |
| You can use multiple ivy settings during a build. Then every ivy task should specify the settings it uses using the settingsRef attribute. |
| <code> |
| <ivy:settings id="ivy.normal.settings" file="normal_settings.xml" /> |
| <ivy:settings id="ivy.release.settings" file="release_settings.xml" /> |
| |
| <ivy:resolve settingsRef="ivy.normal.settings" /> |
| <ivy:resolve settingsRef="ivy.release.settings" /> |
| </code> |
| </textarea> |
| <script type="text/javascript">xooki.postProcess();</script> |
| </body> |
| </html> |