【发布时间】:2013-05-19 01:31:00
【问题描述】:
我做了一个 Gradle 构建,当使用 ivy-publish 插件时,我生成 jars 和 ivy.xml 描述符以及我的项目的配置和依赖项,但是什么是这个文件的目的?为什么使用我的构建的运行时应用程序需要知道要提供哪些 jar 或..??
【问题讨论】:
我做了一个 Gradle 构建,当使用 ivy-publish 插件时,我生成 jars 和 ivy.xml 描述符以及我的项目的配置和依赖项,但是什么是这个文件的目的?为什么使用我的构建的运行时应用程序需要知道要提供哪些 jar 或..??
【问题讨论】:
ivy.xml 文件是您模块的元数据文件。
一个ivy文件分为以下几个部分:
<publications>
An ivy module can publish multiple files. The purpose of this section is to
list them
</publications>
<configurations>
This section describes the various logical file groups that can exist in your
module
</configurations>
<dependencies>
This section describes the dependencies that might exist on other modules.
One can create mappings between different configurations here as well.
</dependencies>
至少您需要发布部分。它列出了可用的文件。因此,如果我请求“moduleA”,常春藤客户端就会知道要下载哪些文件。
配置是可选的,最初是一个难以掌握的概念,但它们允许您控制已发布文件的子集以供下载。例如,您只需要二进制文件或源包。
最后是依赖。这使得 ivy 客户端不仅可以下载 ModuleA 的文件,还可以下载属于 ModuleA 所依赖的其他模块的文件。通常,这些是编译代码可能需要的第三方库,或者需要在运行时额外位于您的类路径中。常春藤可以自动为你做这件事。 (同样,这些类路径的内容可以使用配置进行自定义:在“运行时”或“测试”代码时需要“编译”的 jar)
【讨论】: