在 Gradle 中递归发布可能/容易吗?
我们有一个基于 Ant 和 Ivy 的构建管理系统,它基本上由一个共享的 ant 文件和一组围绕目录结构的约定组成。
我试图克服的一个障碍是相当常见的“递归发布”情况。假设我们有 5 个内部代码模块,它们具有如下所示的依赖关系图:
- 每个模块都应该发布其 ivy 可
- 尚未批准部署到测试的工件应具有“集成”状态
- 部署到测试的工件应具有“里程碑”状态(由开发人员手动提升)
- 经测试人员验证的工件应具有状态“release”
假设开发人员已在本地签出所有 5 个模块,并对它们进行了全部更改。现在他要把自己的所有改变提升到“里程碑”的地位。换句话说,ivy 仓库中应该发生的情况是:
- e-1.0-RC1 发布
- d-1.1-RC2 发布,引用 e-1.0-RC1 作为依赖项
- c-2.0-RC1 发布,引用 d-1.1-RC2作为依赖项
- b-3.3-RC1 被发布,引用 e-1.0-RC1 作为依赖项
- 最后,a-7.1-RC2 被发布,引用c-2.0-RC1 和 b-3.3-RC1 作为依赖项。
我还没有找到一种简单的方法来使用 ivy + ant 来做到这一点(ivy 承诺类似的称为递归传递的东西,但我找不到它的任何工作示例)。
Gradle 在这里听起来很有前途,因为它似乎对多项目构建有很好的支持。我确实浏览了文档,但没有立即找到这个案例作为例子。有没有 用 gradle 实现这一点的简单方法?
We have an Ant and Ivy-based build management system, which basically consists of a shared ant file and a set of conventions around directory structure.
One hurdle I'm trying to overcome is the fairly common case of "recursive publish". Say, we have 5 in-house code modules that have a dependency graph like this:
- Each module should publish its ivy artifacts to our internal repo
- Artifacts not yet cleared for deployment to test should have status "integration"
- Artifacts deployable to test should have status "milestone" (manually promoted by developer)
- Artifacts verified by testers should have status "release"
Say a developer has all 5 modules checked out locally, and has made changes to them all. Now he wants to promote all his changes to "milestone" status. In other words what should happen in the ivy repo is:
- e-1.0-RC1 gets published
- d-1.1-RC2 gets published, referencing e-1.0-RC1 as a dependency
- c-2.0-RC1 gets published, referencing d-1.1-RC2 as a dependency
- b-3.3-RC1 gets published, referencing e-1.0-RC1 as a dependency
- Finally, a-7.1-RC2 gets published, referencing c-2.0-RC1 and b-3.3-RC1 as dependencies.
I haven't found an easy way to do this using ivy + ant (Ivy promises something similar called recursive deliver, but I can't find any working examples of it).
Gradle sounds promising here since it seems to have good support for multi project builds. I did skim through the docs, but didn't immediately find this case as an example. Is there
an easy way to achieve this with gradle?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我能想到的唯一方法是使用主构建文件,将版本号传播到每个模块的单独构建文件。这有一个不幸的副作用,即将您的五个模块绑定到一个需要作为单个实体进行管理的单元中,但这可能是实现您正在寻找的目标的唯一方法。
The only way I can conceive of this working is with a master build file that propagates version numbers down to the individual build files for each of your modules. This has the unfortunate side effect of binding your five modules into a unit that would need to be managed as a single entity but it may be the only way to achieve what you're looking for.
对我来说,这看起来像是一个正常的多项目构建。假设您正在使用基于 JVM 的语言,Gradle 可以使用约定提供良好的开箱即用支持(您可以自由地覆盖这些约定来满足项目的需求) - 尝试一下看看。
请随意询问有关使用 Gradle 进行多项目构建的更多具体细节。
That looks like a normal multi-project build to me. Assuming you are doing a JVM-based language, Gradle has good out-of-the-box support using conventions (you are free to override those conventions to match your projects' needs) - try it and see.
Feel free to ask for more specific detail on a multi-project build using Gradle.