用于发布工件的ivy.xml的用途?

时间:2013-05-23 15:35:48

标签: build gradle ivy

我制作了Gradle版本,当使用 ivy-publish 插件时,我生成了jars和 ivy.xml 描述符以及我项目的配置和依赖项,但是什么是这个档案的目的?为什么运行时应用程序需要使用我的构建来知道要提供哪些jar或者?? ??

1 个答案:

答案 0 :(得分:3)

ivy.xml文件是模块的元数据文件。

常春藤文件分为以下几个部分:

<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文件)

相关问题