您可以将以下内容放入 $HOME/.ivy2/ivysettings.xml
这将使 ivy(并因此播放依赖解析)首先查看本地 maven 存储库,然后使用您的存储库管理器(类似于 .m2/settings.xml 中的 mirrorOf *)。
<ivy-settings>
<!-- path to local maven repo and default maven layout -->
<property name="local-maven2-pattern" value="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision]" override="false" />
<!-- set resolver chain as default -->
<settings defaultResolver="main" />
<!-- configure caches -->
<caches repositoryCacheDir="${user.home}/.ivy2/cache">
<!-- do not cache from local .m2-->
<cache name="nocache" useOrigin="true" />
<cache name="default" />
</caches>
<resolvers>
<chain name="main">
<!-- as this is not cached, even changing SNAPSHOT dependencies are resolved correctly -->
<filesystem name="local-maven-2" m2compatible="true" local="true" cache="nocache">
<ivy pattern="${local-maven2-pattern}.pom" />
<artifact pattern="${local-maven2-pattern}(-[classifier]).[ext]" />
</filesystem>
<!-- use repository manager as proxy to maven-central (and alle other repositories)-->
<ibiblio name="repomanager" m2compatible="true"root="http://your.repomanager.intra/path/to/repo" cache="default"/>
</chain>
</resolvers>
</ivy-settings>