Use public maven repository with ivy

You need to add an ivysettings.xml file with the following repositories listed (resolvers in ivy speak)

<ivysettings>
    <settings defaultResolver="chain"/>
    <resolvers>
        <chain name="chain">
            <ibiblio name="central" m2compatible="true"/>
            <ibiblio name="example" m2compatible="true" root="http://example.com/m2/"/>
        </chain>
    </resolvers>
</ivysettings>

In my opinion it makes more sense to separate the dependency declaration (ivy.xml) from the mechanism of retrieval (settings.xml). This is not needed in Maven because it only supports one type of repository.

If you want to get really fancy you can control which respository serves up a particular module:

<ivysettings>
    <settings defaultResolver="central"/>
    <resolvers>
        <ibiblio name="central" m2compatible="true"/>
        <ibiblio name="example" m2compatible="true" root="http://example.com/m2/"/>
    </resolvers>
    <modules>
        <module organisation="foo-bar" name="superwidgets" resolver="example"/>
    </modules>
</ivysettings>

Leave a Comment