install任务让你从一个仓库复制一个模块或者模块集合到另一个仓库。这对于构建和维护一个企业或 者团队仓库非常有用。如果你不想你的团队中的开发人员都访问公共的maven2仓库(例如为了控制哪些模 块可以在你的公司或者你的团队中使用),答复开发人员的请求来手工增加新的模块或者新的版本在某些 时候变得令人厌烦。
幸运的是install任务可以在这里提供帮助: 你可以为你的用于维护目标企业仓库的仓库维护构建使用 特定的设置。这些设置将指向另一个仓库(例如maven2 公共仓库),因此你只需要使用简单的命令行要求 ivy安装你需要的模块。
为了演示这个我们将首先使用个一些基本的ivy设置文件来展示它是如何工作的,然后我们将使用高级 命名空间特性来演示如何在源仓库和目标仓库之间处理命名不匹配。
1) 使用的项目
我们将要使用的项目非常简单。
它由一个ant 构建文件和一些ivy设置文件组成。
这里有一些我们将要使用的target:
Z:/ivy-reposiTory>ant -pBuildfile: build.xmlMain targets: clean-cache --> clean the cache clean-repo --> clean the destination reposiTory maven2 --> install module from maven 2 reposiTory maven2-deps --> install module from maven 2 reposiTory with dependencies maven2-namespace --> install module from maven 2 using namespaces maven2-namespace-deps --> install module with dependencies from maven2 repo using namespacesDefault target: basic
这个项目在src/example/build-a-ivy-reposiTory下。
转动心中的期待,血在澎湃,吃苦流汗算什么。