Added: ant/ivy/site/target/history/2.2.0-rc1/tutorial/conf.html URL: http://svn.apache.org/viewvc/ant/ivy/site/target/history/2.2.0-rc1/tutorial/conf.html?rev=961685&view=auto ============================================================================== --- ant/ivy/site/target/history/2.2.0-rc1/tutorial/conf.html (added) +++ ant/ivy/site/target/history/2.2.0-rc1/tutorial/conf.html Thu Jul 8 10:00:21 2010 @@ -0,0 +1,325 @@ + + + + + + + + +Using Ivy Module Configurations | Apache Ivy + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ +
+ +
+ + + + +
+ + +
+ + +
+ + + + + + + +
+
+ +

Using Ivy Module Configurations

+
This tutorial introduces the use of module configurations in ivy files. Ivy module configurations is indeed a very important concept. Someone even told me one day that using Ivy without using configurations is like eating a good cheese without touching the glass of Chateau Margaux 1976 you have just aside :-)

More seriously, configurations in ivy can be better understood as views on your module, and you will see how they can be used efficiently here.

Reference documentation on configurations can be found here and here.

Introduction

+Source code available in src/example/configurations/multi-projects.
We have two projects :
- filter-framework is a library that defines an api to filter String arrays and two implementations of this api.
- myapp is a very small app that uses filter-framework.

The library produces 3 artifacts:
- the api jar,
- an implementation jar with no external dependency,
- an other implementation that needs commons-collections to perform.

The application only need api to compile and can use any of the two implementation at runtime.

The library project

+The first project we defined in this tutorial is the filter-framework.
In order to have a fine grained artifacts publication definition, we defined configurations to map usage other can make of our library.

The ivy.xml file

+ +
+
+<ivy-module version="1.0">
<info organisation="org.apache" module="filter-framework"/>
<configurations>
<conf name="api" description="only provide filter framework API"/>
<conf name="homemade-impl" extends="api" description="provide a home made implementation of our api"/>
<conf name="cc-impl" extends="api" description="provide an implementation that use apache common collection framework"/>
<conf name="test" extends="cc-impl" visibility="private" description="for testing our framework"/>
</configurations>
<publications>
<artifact name="filter-api" type="jar" conf="api" ext="jar"/>
<artifact name="filter-hmimpl" type="jar" conf="homemade-impl" ext="jar"/>< br class="xooki-br"/> <artifact name="filter-ccimpl" type="jar" conf="cc-impl" ext="jar"/>
</publications>
<dependencies>
<dependency org="commons-collections" name="commons-collections" rev="3.1" conf="cc-impl->default"/>
<dependency org="junit" name="junit" rev="3.8" conf="test->default"/>
</dependencies>
</ivy-module> +
+
+

Explanation

+As you can see we defined 3 public configurations and a private one (defined junit dependency for testing).
The 2 implementations conf homemade-impl, cc-impl extends api configuration so artifacts defined in api will also be required in its extending conf.
In the publications tag we defined the artifacts we produce (here it's jars) and we affect them a configuration.
Later when others will use our library they will have a very flexible way to define what they need.

See it in action

+The library project is build using ant. Open a shell in the root directory of the project and type ant. +
+[ivy@apache:/ivy/configurations/multi-projects/filter-framework]$ ant 
+Buildfile: /ivy/configurations/multi-projects/filter-framework/build.xml
+
+clean:
+
+resolve:
+[ivy:retrieve] :: Ivy 2.2.0-rc1 - 20100629224905 :: http://ant.apache.org/ivy/ ::
+[ivy:retrieve] :: loading settings :: url = jar:file:///home/ivy/ivy.jar!/org/apache/ivy/core/settings/ivysettings.xml
+[ivy:retrieve] :: resolving dependencies :: org.apache#filter-framework;working@apache
+[ivy:retrieve] 	confs: [api, homemade-impl, cc-impl, test]
+[ivy:retrieve] 	found commons-collections#commons-collections;3.1 in public
+[ivy:retrieve] 	found junit#junit;3.8 in public
+[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-collections/commons-collections/3.1/commons-collections-3.1.jar ...
+[ivy:retrieve] ...............................................................................................................................................................................................................................................................................................................................................................................................................................................
+[ivy:retrieve] ......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... (546kB)
+[ivy:retrieve] .. (0kB)
+[ivy:retrieve] 	[SUCCESSFUL ] commons-collections#commons-collections;3.1!commons-collections.jar (4992ms)
+[ivy:retrieve] downloading http://repo1.maven.org/maven2/junit/junit/3.8/junit-3.8.jar ...
+[ivy:retrieve] ............................................................................................................................................................................................................................................ (118kB)
+[ivy:retrieve] .. (0kB)
+[ivy:retrieve] 	[SUCCESSFUL ] junit#junit;3.8!junit.jar (2465ms)
+[ivy:retrieve] :: resolution report :: resolve 7473ms :: artifacts dl 7457ms
+	---------------------------------------------------------------------
+	|                  |            modules            ||   artifacts   |
+	|       conf       | number| search|dwnlded|evicted|| number|dwnlded|
+	---------------------------------------------------------------------
+	|        api       |   0   |   0   |   0   |   0   ||   0   |   0   |
+	|   homemade-impl  |   0   |   0   |   0   |   0   ||   0   |   0   |
+	|      cc-impl     |   1   |   1   |   1   |   0   ||   1   |   1   |
+	|       test       |   2   |   2   |   2   |   0   ||   2   |   2   |
+	---------------------------------------------------------------------
+[ivy:retrieve] :: retrieving :: org.apache#filter-framework
+[ivy:retrieve] 	confs: [api, homemade-impl, cc-impl, test]
+[ivy:retrieve] 	3 artifacts copied, 0 already retrieved (1211kB/62ms)
+
+build:
+    [mkdir] Created dir: /ivy/configurations/multi-projects/filter-framework/build
+    [mkdir] Created dir: /ivy/configurations/multi-projects/filter-framework/distrib
+    [javac] /ivy/configurations/multi-projects/filter-framework/build.xml:57: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
+    [javac] Compiling 4 source files to /ivy/configurations/multi-projects/filter-framework/build
+    [javac] Note: Some input files use unchecked or unsafe operations.
+    [javac] Note: Recompile with -Xlint:unchecked for details.
+      [jar] Building jar: /ivy/configurations/multi-projects/filter-framework/distrib/filter-api.jar
+      [jar] Building jar: /ivy/configurations/multi-projects/filter-framework/distrib/filter-hmimpl.jar
+      [jar] Building jar: /ivy/configurations/multi-projects/filter-framework/distrib/filter-ccimpl.jar
+
+test:
+    [mkdir] Created dir: /ivy/configurations/multi-projects/filter-framework/build/test-report
+    [mkdir] Created dir: /ivy/configurations/multi-projects/filter-framework/build/test-classes
+    [javac] /ivy/configurations/multi-projects/filter-framework/build.xml:82: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
+    [javac] Compiling 3 source files to /ivy/configurations/multi-projects/filter-framework/build/test-classes
+    [junit] Running filter.ccimpl.CCFilterTest
+    [junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 0,109 sec
+    [junit] Running filter.hmimpl.HMFilterTest
+    [junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 0,062 sec
+
+publish:
+[ivy:publish] :: delivering :: org.apache#filter-framework;working@apache :: 1.3 :: release :: Tue Jun 29 22:58:46 CEST 2010
+[ivy:publish] 	delivering ivy file to /ivy/configurations/multi-projects/filter-framework/distrib/ivy.xml
+[ivy:publish] :: publishing :: org.apache#filter-framework
+[ivy:publish] 	published filter-api to /home/ivy/.ivy2/local/org.apache/filter-framework/1.3.part/jars/filter-api.jar
+[ivy:publish] 	published filter-hmimpl to /home/ivy/.ivy2/local/org.apache/filter-framework/1.3.part/jars/filter-hmimpl.jar
+[ivy:publish] 	published filter-ccimpl to /home/ivy/.ivy2/local/org.apache/filter-framework/1.3.part/jars/filter-ccimpl.jar
+[ivy:publish] 	published ivy to /home/ivy/.ivy2/local/org.apache/filter-framework/1.3.part/ivys/ivy.xml
+[ivy:publish] 	publish commited: moved /home/ivy/.ivy2/local/org.apache/filter-framework/1.3.part 
+[ivy:publish] 		to /home/ivy/.ivy2/local/org.apache/filter-framework/1.3
+     [echo] project filter-framework released with version 1.3
+
+BUILD SUCCESSFUL
+Total time: 21 seconds
+
+
+The ant's default target is publish.
This target uses ivy to publish our library binaries in a local repository.
As we do not specify any repository path the default one is used. ({home.dir}/.ivy2/local/org.apache/filter-framework/)
Now we are ready to use our library.

The application project

+ +Now that we have shipped our fantastic library, we want to use it!
The tutorial comes with a sample application called myapp.

The ivy.xml file

+ +
+
+<ivy-module version="1.0">
<info organisation="org.apache" module="myapp"/>

<configurations>
<conf name="build" visibility="private" description="compilation only need api jar" />
<conf name="noexternaljar" description="use only company jar" />
<conf name="withexternaljar" description="use company jar and third party jars" />
</configurations>

<dependencies>
<dependency org="org.apache" name="filter-framework" rev="latest.integration" conf="build->api; noexternaljar->homemade-impl; withexternaljar->cc-impl"/>
</dependencies>
</ivy-module> +
+
+

Explanation

+We create 3 configurations that define the way we want to use the application.
The build configuration defines the compile-time dependencies, and thus only needs the api conf from filter-framework.
The other configurations define runtime dependencies. One will only use "home-made" jars, and the other will use external jars.

We also defined a dependency on the previous library.
In the dependency we use configuration mapping to match ours and library configurations.
You can found more information on configuration mapping here
    +
  1. build->api : here we tell ivy that our build configuration depends on the api configuration of the dependcy
  2. +
  3. noexternaljar->homemade-impl : here we tell ivy that our noexternaljar configuration depends on the homemade-impl configuration of the dependcy.
  4. +
  5. withexternaljar->cc-impl : here we tell ivy that our withexternaljar configuration depends on the cc-impl configuration of the dependcy
  6. +
+Note that we never declare any of the dependency artifacts we need in each configuration: it's the dependency module file which declares the published artifacts and which should be used in each configuration.

In the ant buld.xml file we defined a resolve target as follow:
+
+<target name="resolve" description="--> retreive dependencies with ivy">
<ivy:retrieve pattern="${ivy.lib.dir}/[conf]/[artifact].[ext]"/>
</target> +
+ +When we call this target, Ivy will do a resolve using our ivy.xml file in the root folder and then retrieve all the artifacts. The artifacts retrieved are kept in separate folders according to the configurations they belong to. Here is how your lib directory should look like after a call to this target: +
+ Repertoire de D:\ivy\src\example\configurations\multi-projects\myapp\lib

01/24/2006 11:19 AM build
01/24/2006 11:19 AM noexternaljar
01/24/2006 11:19 AM withexternaljar
0 fichier(s) 0 octets

Repertoire de D:\ivy\src\example\configurations\multi-projects\myapp\lib\build

01/24/2006 10:53 AM 1,174 filter-api.jar
1 fichier(s) 1,174 octets

Repertoire de D:\ivy\src\example\configurations\multi-projects\myapp\lib\noexternaljar

01/24/2006 10:53 AM 1,174 filter-api.jar
01/24/2006 10:53 AM 1,030 filter-hmimpl.jar
2 fichier(s) 2,204 octets

Repertoire de D:\ivy\src\example\configurations\multi-projects\myapp\lib\withexternaljar
01/24/2006 10:53 AM 559,366 commons-collections.jar
01/24/2006 10:53 AM 1,174 filter-api.jar
01/24/2006 10:53 AM 1,626 filter-ccimpl.jar
3 fichier(s) 562,166 octets +
+As you can see for each configuration we have now a set of jars.

Let's try to launch our app.

See it in action

+Use ant to run the application.
Default ant target is run-cc and will launch application using the Apache commons-collections implementation. +
+[ivy@apache:/ivy/configurations/multi-projects/myapp]$ ant 
+Buildfile: /ivy/configurations/multi-projects/myapp/build.xml
+
+resolve:
+[ivy:retrieve] :: Ivy 2.2.0-rc1 - 20100629224905 :: http://ant.apache.org/ivy/ ::
+[ivy:retrieve] :: loading settings :: url = jar:file:///home/ivy/ivy.jar!/org/apache/ivy/core/settings/ivysettings.xml
+[ivy:retrieve] :: resolving dependencies :: org.apache#myapp;working@apache
+[ivy:retrieve] 	confs: [build, noexternaljar, withexternaljar]
+[ivy:retrieve] 	found org.apache#filter-framework;1.3 in local
+[ivy:retrieve] 	[1.3] org.apache#filter-framework;latest.integration
+[ivy:retrieve] 	found commons-collections#commons-collections;3.1 in public
+[ivy:retrieve] downloading /home/ivy/.ivy2/local/org.apache/filter-framework/1.3/jars/filter-api.jar ...
+[ivy:retrieve] .. (1kB)
+[ivy:retrieve] .. (0kB)
+[ivy:retrieve] 	[SUCCESSFUL ] org.apache#filter-framework;1.3!filter-api.jar (31ms)
+[ivy:retrieve] downloading /home/ivy/.ivy2/local/org.apache/filter-framework/1.3/jars/filter-ccimpl.jar ...
+[ivy:retrieve] .. (1kB)
+[ivy:retrieve] .. (0kB)
+[ivy:retrieve] 	[SUCCESSFUL ] org.apache#filter-framework;1.3!filter-ccimpl.jar (32ms)
+[ivy:retrieve] downloading /home/ivy/.ivy2/local/org.apache/filter-framework/1.3/jars/filter-hmimpl.jar ...
+[ivy:retrieve] .. (1kB)
+[ivy:retrieve] .. (0kB)
+[ivy:retrieve] 	[SUCCESSFUL ] org.apache#filter-framework;1.3!filter-hmimpl.jar (31ms)
+[ivy:retrieve] :: resolution report :: resolve 406ms :: artifacts dl 124ms
+	---------------------------------------------------------------------
+	|                  |            modules            ||   artifacts   |
+	|       conf       | number| search|dwnlded|evicted|| number|dwnlded|
+	---------------------------------------------------------------------
+	|       build      |   1   |   1   |   1   |   0   ||   1   |   1   |
+	|   noexternaljar  |   1   |   1   |   1   |   0   ||   2   |   2   |
+	|  withexternaljar |   2   |   1   |   1   |   0   ||   3   |   2   |
+	---------------------------------------------------------------------
+[ivy:retrieve] :: retrieving :: org.apache#myapp
+[ivy:retrieve] 	confs: [build, noexternaljar, withexternaljar]
+[ivy:retrieve] 	6 artifacts copied, 0 already retrieved (552kB/110ms)
+
+build:
+    [mkdir] Created dir: /ivy/configurations/multi-projects/myapp/build
+    [javac] /ivy/configurations/multi-projects/myapp/build.xml:56: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
+    [javac] Compiling 1 source file to /ivy/configurations/multi-projects/myapp/build
+
+run-cc:
+     [java] Filtering with:class filter.ccimpl.CCFilter
+     [java] Result :[two, tree]
+
+BUILD SUCCESSFUL
+Total time: 4 seconds
+
+
+Launching application with only home made jars is straightforward.
type ant run-hm
+
+[ivy@apache:/ivy/configurations/multi-projects/myapp]$ ant run-hm
+Buildfile: /ivy/configurations/multi-projects/myapp/build.xml
+
+resolve:
+[ivy:retrieve] :: Ivy 2.2.0-rc1 - 20100629224905 :: http://ant.apache.org/ivy/ ::
+[ivy:retrieve] :: loading settings :: url = jar:file:///home/ivy/ivy.jar!/org/apache/ivy/core/settings/ivysettings.xml
+[ivy:retrieve] :: resolving dependencies :: org.apache#myapp;working@apache
+[ivy:retrieve] 	confs: [build, noexternaljar, withexternaljar]
+[ivy:retrieve] 	found org.apache#filter-framework;1.3 in local
+[ivy:retrieve] 	[1.3] org.apache#filter-framework;latest.integration
+[ivy:retrieve] 	found commons-collections#commons-collections;3.1 in public
+[ivy:retrieve] :: resolution report :: resolve 359ms :: artifacts dl 16ms
+	---------------------------------------------------------------------
+	|                  |            modules            ||   artifacts   |
+	|       conf       | number| search|dwnlded|evicted|| number|dwnlded|
+	---------------------------------------------------------------------
+	|       build      |   1   |   0   |   0   |   0   ||   1   |   0   |
+	|   noexternaljar  |   1   |   0   |   0   |   0   ||   2   |   0   |
+	|  withexternaljar |   2   |   0   |   0   |   0   ||   3   |   0   |
+	---------------------------------------------------------------------
+[ivy:retrieve] :: retrieving :: org.apache#myapp
+[ivy:retrieve] 	confs: [build, noexternaljar, withexternaljar]
+[ivy:retrieve] 	0 artifacts copied, 6 already retrieved (0kB/47ms)
+
+build:
+    [javac] /ivy/configurations/multi-projects/myapp/build.xml:56: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
+
+run-hm:
+     [java] Filtering with:class filter.hmimpl.HMFilter
+     [java] Result :[two, tree]
+
+BUILD SUCCESSFUL
+Total time: 2 seconds
+
+Nice we got the same result but we can see that implementation classes are different.

Conclusion

+You should use configurations as often as possible
Configurations are very important concept in ivy. They allow you to group artifacts by meaning.
When you write ivy file for projects that are supposed to be reused, use configurations to allow people to get only they what they need without having to specify it by hand using artifact tag in dependency section.
+
+
+ + + + + + + + + + + + +
+ + Propchange: ant/ivy/site/target/history/2.2.0-rc1/tutorial/conf.html ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ant/ivy/site/target/history/2.2.0-rc1/tutorial/defaultconf.html URL: http://svn.apache.org/viewvc/ant/ivy/site/target/history/2.2.0-rc1/tutorial/defaultconf.html?rev=961685&view=auto ============================================================================== --- ant/ivy/site/target/history/2.2.0-rc1/tutorial/defaultconf.html (added) +++ ant/ivy/site/target/history/2.2.0-rc1/tutorial/defaultconf.html Thu Jul 8 10:00:21 2010 @@ -0,0 +1,199 @@ + + + + + + + + +Adjusting default settings | Apache Ivy + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ +
+ +
+ + + + +
+ + +
+ + +
+ + + + + + + +
+
+ +

Adjusting default settings

+
Ivy comes bundled with some default settings which makes it pretty simple to use in common environment. This tutorial, which is close to a reference documentation, explains what are those default settings and how they can be adjusted to your needs.

To fully understand the concept of settings and what you can do with them, we suggest reading other tutorial related to settings (like Multiple Resolvers and Dual Resolver) or the Settings Files reference documentation.

Concept

+This default settings mainly consist of 3 kind of repositories: +
    +
  • local
  • a repository which is private to the user. +
  • shared
  • a repository which is shared between all the member of a team +
  • public
  • a public repository on which most modules, and especially third party modules, can be found +
+ +Note that if you work alone, the distinction between local and shared repository is not very important, but there are some things to know to distinguish them.

Now let's describe each of these repositories concept in more details. We will describe how they are setup physically later.

Local

+The local repository is particularly useful when you want to do something without being disturbed by anything else happening in the environment. This means that whenever ivy is able to locate a module in this repository it will be used, no matter of what is available in others.

For instance, if you have a module declaring a dependency on the module foo in revision latest.integration, then if a revision of foo is found in the local repository, it will be used, even if a more recent revision is available in other repositories.

This may be disturbing for some of you, but imagine you have to implement a new feature on a project, and in order to achieve that you need to modify two modules: you add a new method in module foo and exploit this new method in module bar. Then if you publish the module foo to your local repository, you will be sure to get it in your bar module, even if someo ne else publish a new revision of foo in the shared repository (this revision not having the new method you are currently adding).

But be careful, when you have finished your development and publish it on the shared you will have to clean your local repository to benefit from new versions published in the shared repository.

Note also that modules found in the local repository must be complete, i.e. they must provide both a module descriptor and the published artifacts.

Shared

+As its name suggest, the shared repository is aimed to be shared among a whole development team. It is a place where you can publish your team private modules for instance, and it's also a place where you can put modules not available in the public repository (sun jars, for instance), or simply not accurate (bad or incomplete module descriptors for instance).

Note that modules can be split across the shared repository and the public one: you can have the module descriptor in the shared repository and the artifacts in the public one, for instance.

Public

+The public repository is the place where most modules can be found, but which sometimes lack the information you need. It's usually a repository available through an internet connection only, even if this is not mandatory.

Setting up the repositories

+Now that we have seen the objective of each of the three repositories, let's see how they are setup and how to configure them to fit your needs.

First, several repositories uses the same root in your filesystem. Referenced as ${ivy.default.ivy.user.dir}, this is by default the directory .ivy2 in your user home.

Note that several things can be done by setting ivy variable. To set them without defining your own ivysettings.xml file, you can:
    +
  • set an ant property before any call to ivy in your build file if you use ivy from ant
  • +
  • set an environment variable if you use ivy from the command line
  • +
+For instance: +
+<target name="resolve">
<property name="ivy.default.ivy.user.dir" value="/path/to/ivy/user/dir"/>
<ivy:resolve />
</target> +
+ +Now we will show how to override default values for the different kind of repositories, note that you can find what are these default values below in the detail of the default settings.

Local

+By default, the local repository lies in ${ivy.default.ivy.user.dir}/local. This is usually a good place, but you may want to modify it however. No problem, you just have to set the following ivy variable to the directory you want to use:
ivy.local.default.root
. For instance: +
ivy.local.default.root=/opt/ivy/repository/local
.

If you already have something you would like to use as your local repository, you may also want to modify the layout of this repository. Once again, two variables are available for that: +
ivy.local.default.ivy.pattern
gives the pattern to find ivy files +
ivy.local.default.artifact.pattern
gives the pattern to find artifacts
For example: +
+ivy.local.default.root=/opt/ivy/repository/local
ivy.local.default.ivy.pattern=[module]/[revision]/ivy.xml
ivy.local.default.artifact.pattern=[module]/[revision]/[artifact].[ext] +
+

Shared

+By default, the shared repository lies in ${ivy.default.ivy.user.dir}/shared. This is fine if you work alone, but the shared repository is supposed to be, mmm, shared! So changing this directory is often required, and it is usually modified to point to a network shared directory. You can use
ivy.shared.default.root
variable to specify in a new directory. Moreover, you can also configure the layout with variables similar to the one for the local repository: +
ivy.shared.default.ivy.pattern
gives the pattern to find ivy files +
ivy.shared.default.artifact.pattern
gives the pattern to find artifacts
For example: +
+ivy.shared.default.root=/opt/ivy/repository/shared
ivy.shared.default.ivy.pattern=[organisation]/[module]/[revision]/ivy.xml
ivy.shared.default.artifact.pattern=[organisation]/[module]/[revision]/[artifact].[ext] +
+ +

Public

+By default, the public repository is ibiblio in m2 compatible mode (in other words, the maven 2 public repository).

This repository has the advantage of providing a lot of modules, with metadata for most of them. The quality of metadata is not always perfect, but it's a very good start to use a tool like Ivy and benefit from the power of transitive dependency management.

Despite its ease of use, we suggest reading the Best practices to have a good understanding of the pros and cons of using a public unmanaged repository before depending on such a repository for your enterprise build system.

In 1.4 version Ivy was using ivyrep has default resolver, if you want to restore this, set
ivy.14.compatible=true as an ant property


Going further +OK, so we have seen how to easily change the settings of the three main repositories. But what if my shared repository is on a web server? What if you don't want to use maven 2 repository as public repository? What if ...

No problem, Ivy is very flexible and can be configured with very specific settings to match your needs and environment. But before considering writing your own settings from scratch, we suggest reading the following where you will learn how to leverage a part of the default settings and adjust the rest.

But before explaining how, you will need to have a quick overview of how ivy is configured by default.

By default, ivy is configured using an ivysettings.xml which is packaged in the ivy jar. Here is this settings file: +
+<ivysettings>
<settings defaultResolver="default"/>
<include url="${ivy.default.settings.dir}/ivysettings-public.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-shared.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-local.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-default-chain.xml"/>
</ivysettings> +
+OK, so not much info here, except a lot of inclusions. These inclusions have been done on purpose so that you can easily change only one part of the ivysettings and benefit of the rest easily. For example, if you want to define your own public resolver, you will just have to configure ivy with an ivysettings like that: +
+<ivysettings>
<settings defaultResolver="default"/>
<include url="http://myserver/ivy/myivysettings-public.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-shared.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-local.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-default-chain.xml"/>
</ivysettings> +
+Note that only the ivysettings-public inclusion has changed to include a home made public resolver. Note also that this can be used like that thanks to the fact that ${ivy.default.settings.dir} is a variable which is always set to the place where ivy default settings files are (i.e. packaged in the jar).
To finish this example, you have to write your own ivysettings file (that you will make available at http://myserver/ivy/myivysettings-public.xml in this example) for defining your own public resolver. For instance: +
+<ivysettings>
<resolvers>
<filesystem name="public">
<ivy pattern="/path/to/my/public/rep/[organisation]/[module]/ivy-[revision].xml" />
<artifact pattern="/path/to/my/public/rep/[organisation]/[module]/[artifact]-[revision].[ext]" />
</filesystem>
</resolvers>
</ivysettings> +
+Now the last thing you will need in order to properly take advantage of the default settings is the content of each included ivysettings file:
ivysettings-public.xml +
+<ivysettings>
<resolvers>
<ibiblio name="public" m2compatible="true"/>
</resolvers>
</ivysettings> +
+ivysettings-shared.xml +
+<ivysettings>
<property name="ivy.shared.default.root" value="${ivy.default.ivy.user.dir}/shared" override="false"/>
<property name="ivy.shared.default.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="false"/>
<property name="ivy.shared.default.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="false"/>
<resolvers>
<filesystem name="shared">
<ivy pattern="${ivy.shared.default.root}/${ivy.shared.default.ivy.pattern}" />
<artifact pattern="${ivy.shared.default.root}/${ivy.shared.default.artifact.pattern}" />
</filesystem>
</resolvers>
</ivysettings> +
+ivysettings-local.xml +
+<ivysettings>
<property name="ivy.local.default.root" value="${ivy.default.ivy.user.dir}/local" override="false"/>
<property name="ivy.local.default.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="false"/>
<property name="ivy.local.default.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="false"/>
<resolvers>
<filesystem name="local">
<ivy pattern="${ivy.local.default.root}/${ivy.local.default.ivy.pattern}" />
<artifact pattern="${ivy.local.default.root}/${ivy.local.default.artifact.pattern}" />
</filesystem>
</resolvers>
</ivysettings> +
+ivysettings-main-chain.xml +
+<ivysettings>
<resolvers>
<chain name="main" dual="true">
<resolver ref="shared"/>
<resolver ref="public"/>
</chain>
</resolvers>
</ivysettings> +
+ivysettings-default-chain.xml +
+<ivysettings>
<resolvers>
<chain name="default" returnFirst="true">
<resolver ref="local"/>
<resolver ref="main"/>
</chain>
</resolvers>
</ivysettings> +
+ +Here you are, you have enough clues to configure that the way you want... check the settings documentation to see if what you want to do is possible, and go ahead!
+

+
+ + + + + + + + + + + + +
+ + Propchange: ant/ivy/site/target/history/2.2.0-rc1/tutorial/defaultconf.html ------------------------------------------------------------------------------ svn:mime-type = text/plain