gpt4 book ai didi

java - 将 ivy 依赖点指向本地文件?

转载 作者:行者123 更新时间:2023-11-30 07:39:15 27 4
gpt4 key购买 nike

我有一个主项目,其中模块 A 依赖于为模块 B 的构建创建的 .jar 文件。在开发过程中,我定期修改 B,然后构建 B 以创建库,然后构建 A 以使用这些更改。

有没有办法将模块 A 的 ivy 文件指向我的模块 B 构建创建的 jar 文件?考虑到我要迭代多次,我不想一遍又一遍地将模块 B 的 jar 检查到 ivy 中。在每次模块 B 构建之后必须将 jar 复制到模块 A 的构建目录结构中也很烦人。

实际上,对我来说情况更糟,因为我在某种依赖树 (A->B->CD) 中有大约 4 个模块。如果它只是 A 和 B,我可能会接受它,但我厌倦了在子模块构建后复制 jar 文件,并想是否有一种方法可以覆盖 ivy 文件依赖行以在本地查看,然后让生活变得更简单。

最佳答案

将 Ivy 依赖项指向本地构建的模块并不是解决此问题的方法。相反,当您构建模块 B 时,将其发布到本地 Ivy 存储库。当您解决模块 A 的依赖关系时,它将从您的本地存储库中下载模块 B。

From the Ivy docs on the local repository :

The local repository is particularly useful when you want to do something without being disturbed by anything else happening in the environment. This means that whenever ivy is able to locate a module in this repository it will be used, no matter of what is available in others.

For instance, if you have a module declaring a dependency on the module foo in revision latest.integration, then if a revision of foo is found in the local repository, it will be used, even if a more recent revision is available in other repositories.

This may be disturbing for some of you, but imagine you have to implement a new feature on a project, and in order to achieve that you need to modify two modules: you add a new method in module foo and exploit this new method in module bar. Then if you publish the module foo to your local repository, you will be sure to get it in your bar module, even if someone else publish a new revision of foo in the shared repository (this revision not having the new method you are currently adding).

But be careful, when you have finished your development and publish it on the shared you will have to clean your local repository to benefit from new versions published in the shared repository.

Note also that modules found in the local repository must be complete, i.e. they must provide both a module descriptor and the published artifacts.

Using Ivy in multiple projects environment文档中有一个示例 publish-local Ant 任务,您可能会发现它很有用。

关于java - 将 ivy 依赖点指向本地文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/900084/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com