1) Settings file
In order to work as you think, ivy sometimes needs some setup. In fact, Ivy can work with absolutely no special settings, consult the default settings document to get more detailed information. But Ivy has the ability to work in completely different contexts. You just need to configure it correctly.
The settings are specified through an XML file, usually named called Ivysettings.xml. To configure Ivy in ant, you only need to use the path of your settings file to configure the data type.
Here is an example of a setup file:
<ivysettings>
<properties file="${ivy.settings.dir}/ivysettings-file.properties" />
<settings defaultCache="${cache.dir}" defaultResolver="ibiblio" checkUpToDate="false" />
<resolvers>
<ibiblio name="ibiblio" />
<filesystem name="internal">
<ivy pattern="${repository.dir}/[module]/ivy-[revision].xml" />
<artifact pattern="${repository.dir}/[module]/[artifact]-[revision].[ext]" />
</filesystem>
</resolvers>
<modules>
<module organisation="jayasoft" name=".*" resolver="internal" />
</modules>
</ivysettings>
In general, the setup file can configure the default cache directory used by Ivy and the dependency resolver used to resolve dependencies.
Note: To be able to work, this setup file requires a property file named Ivysettings-file.properties in the same directory as the settings file, which contains the Ivy variables that are required.
There are some useful variables in the settings file:
* Ivy.settings.dir
This variable involves the directory where Ivy sets itself. If the setting is loaded as a file this variable is available. If it is a URL, take the previous section of the URL's last slash "/". If the URL does not have a slash "/", then the variable is not set.
* Ivy.settings.file
Sets the path of the file itself, only when it is loaded as a file. If the settings file is loaded as a URL, the variable is not set.
* Ivy.settings.url
The URL that points to the settings file. Set when the settings file is loaded as a file or URL.
After the ivy1.4 version, all of the main Java System properties can be used as ivy variables in the settings file.