Ivy 是一个依赖管理工具,直观感觉是其跟maven 的做用差很少;但这两个实际上是不一样的工具:html
maven 是面向整个项目的工程管理及构建工具;
ivy 仅做为依赖管理工具,与ant 高度集成。apache
须要了解更多不一样,可看看这里:
http://ant.apache.org/ivy/m2comparison.html缓存
几年前了解到这东西,也是由于 play! 框架内置的依赖使用它进行依赖管理,但至今国内仍然以maven 做为主流依赖管理工具,看来仍是先入为主的问题。
项目尽管使用了 ivy,依赖的处理仍然会选择 maven2 兼容仓库ibiblio,也是国外的站点。
众所周知的缘由,国外站点的资源下载是龟速的,有必要给它提提速了。框架
修改 ${USER_HOME}/.ivy2/ivysettings.xmlmaven
<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 all other repositories)--> <ibiblio name="repomanager" m2compatible="true" root="http://maven.aliyun.com/nexus/content/groups/public/" cache="default"/> </chain> </resolvers> </ivy-settings>
解释
resolvers 配置了 名为main 的依赖处理链,包括两个处理器:
1 本地文件系统,用于兼容 maven2 的路径
若是 已经存在maven项目且下载了依赖包,会从maven 本地 repo目录中获取,不缓存到 ivy目录
2 ibiblio ,兼容maven 的处理器
使用阿里云的 镜像地址(仓库地址),默认缓存到 ivy 目录ide