wouldn't it be better to include the public ivysettings in your 
project-specific ivysettings file (instead of the other way around), and do the 
override logic that way?  the "override" features requires that you know ahead 
of time what is going to be overridden in the parent file.  This will tend to 
accumulate complexity in your master ivysettings file as your project grows.
 
-jason

________________________________

From: Peter Oxenham [mailto:poxen...@resolute.com.au]
Sent: Tue 6/9/2009 10:16 PM
To: dev@ant.apache.org
Subject: Feature Request - Overridable resolvers 



The ivy configuration I am currently have is where all projects include a 
global ivy settings file, which is pretty much the same as the default ivy 
settings. (The whole setup is like the multi-project example but using our own 
set of global ivy settings files)

Here is the dump of the resolvers

resolute [chain] [local, shared]
main [chain] [shared, public]
public [chain] [public-maven, spring]
spring [ibiblio]
local [file]
public-maven [ibiblio]
shared [file]
default [chain] [local, main]


The problem I am having is where a particular project needs some jars from 
another repository, usually a maven2 repository. What I want to do is to 
override the public resolver to include the new repository. What I initially 
tried was to create a project specific ivy settings file and from it include 
the global settings file as well as defining the overriden public resolver.

i.e.

<?xml version="1.0" encoding="UTF-8"?>
<ivysettings>
        <settings defaultResolver="default" />
        <include file="${ivy.global.conf.dir}/ivysettings.xml" />
        <resolvers>
        <ibiblio name="jasig" m2compatible="true"
            root="http://developer.jasig.org/repo/content/repositories/m2"; />

        <ibiblio name="jasig3rd-party" m2compatible="true"
            
root="http://developer.jasig.org/repo/content/repositories/3rd-party"; />

                <chain name="public" returnFirst="true" >
                        <resolver ref="jasig"/>
                        <resolver ref="jasig3rd-party"/>
                        <ibiblio name="public-maven" m2compatible="true" />
                        <ibiblio name="spring" m2compatible="true" 
root="http://s3.amazonaws.com/maven.springframework.org/milestone"/>
                                
                       
                </chain>
        </resolvers>

</ivysettings>

Unfortunately this didn't work. The original "public" resolver was still used 
by the "main" resolver (see resolver dump above).

What I propose is to add an "override" attribute to all resolvers. When set to 
false, the code in 
org.apache.ivy.core.settings.IvySettings.addResolver(DependencyResolver) will 
not add it to the resolversMap if it already exists.

That way as long as my overriden "public" resolver is registered first, then 
when the "main" resolver is defined it will get a reference to my "public" 
resolver instead of the one defined globaly.


What do you think?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to