ivysettings.xml: add local maven path

pistacchio picture pistacchio · Dec 23, 2011 · Viewed 10.1k times · Source

How to add a local path (not URL) to ivysettings.xml? I need to add my Maven local repository (/Users/me/.m2/repository to it.

Thanks

Answer

Mark O'Connor picture Mark O'Connor · Dec 23, 2011

Try the following ivysettings.xml file:

<ivysettings>
    <settings defaultResolver="default"/>
    <property name="m2-pattern" value="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]" override="false" />
    <resolvers>
        <chain name="default">
            <filesystem name="local-maven2" m2compatible="true" >
                <artifact pattern="${m2-pattern}"/>
                <ivy pattern="${m2-pattern}"/>
            </filesystem>
            <ibiblio name="central" m2compatible="true"/>
        </chain>
    </resolvers>
</ivysettings>

It includes Maven central in case the dependency is missing from the local Maven repo.

Note:

The benefits of re-using a local Maven repository are limited. Ivy caches jars retrieved from repostories.