常春藤:使用动态修订 [英] Ivy: Using dynamic revisions
问题描述
我有理解我如何在我的Java中有效地使用 Ivy 的动态修订版项目。
I'm having problems understanding how I to use dynamic revisions of Ivy effectively in my Java projects.
目前,我有以下布局:
lib-a
revision: 1.0.0
status: release
dependencies: none
lib-b
revision: 2.0.0
status: release
dependencies: lib-a, rev 1.0.0
project-a
revision: 3.0.0
status: release
dependencies: lib-b, rev 2.0.0
project-b
revision: 4.0.0
status: release
dependencies: lib-b, rev 2.0.0
这意味着我总是保持状态为 release
使用显式版本号。
如果我在开发期间更改 lib-a
,说 lib-a
,这是非常痛苦的。
That means I always keep the status to release
and use explicit version numbers.
If I would change lib-a
during development, say lib-a
, this is quite painful.
我将更改保存在 lib-a
中,将ivy文件中的修订更新为 1.0.1
进行小的更改。那么我需要更新lib-b的依赖关系来宣布lib-a的修订1.0.1。现在我可以更新 lib-b
和 project-a
的修订版本,因为项目-a
是可执行文件,并包含我需要运行的集成测试。
I save the changes in lib-a
, update the revision in the ivy file to 1.0.1
for a minor change. Then i need to update the dependencies of lib-b to announce the revision 1.0.1 of lib-a. Now I could either update the revision of lib-b
and also project-a
because project-a
is the executable and contains integration tests which I need to run.
第二种方法是重新发布 lib-b
具有更新的依赖关系但相同的版本。这通常适用于命令行上的ant,但不适用于具有 ivy-beans 插件的NetBeans。他们仍然使用缓存版本的 lib-b的常春藤文件。
所以我需要清理本地缓存以使其正常工作。
The second way is to re-publish lib-b
with updated dependencies but same version. This usually works with ant on command line but not for NetBeans with ivy-beans plugin. They still use a cached version of the ivy file of lib-b.
So I need to clean to local cache to make it work.
我在所有项目的SVN存储库中使用一个常见的 build-ivy.xml
ant脚本。每个项目在项目的根目录中都有一个 build.xml
,大部分时间只包含 build-ivy.xml
。有时必要的任务被添加或覆盖。
我刚刚阅读了此处和这里解决方案可能正在使用动态修订版本。
据我了解,我将所有常春藤文件中的修订版本设置为 integration-latest
,并将所有ivy文件中的状态设置为集成
。然后,常春藤会始终自动解决最新版本。
但是我该怎么设置我的模块的修订?完全省略?
我将如何创建发布版本?我需要更改所有常春藤文件,并将状态设置为 release
,或者在将状态覆盖到发布前发布模块时执行交付任务
如果可能,
I use a common build-ivy.xml
ant script that is in our SVN repository for all projects. Each project has a build.xml
in the project's root that most of the time simply includes the build-ivy.xml
. Sometimes necessary tasks are added or overwritten.
I've just read here and here that the solution might be using dynamic revisions.
As far as I understand it, I would set the revision in all ivy files to integration-latest
and set the status in all ivy files to integration
. Then, ivy would always resolve the latest version automatically.
But what would I set the revision of my modules to? Omit it completely?
How would I create a release version? Do I need to change all ivy files and set the status to release
or would I perform a deliver task before publishing a module with overwriting the status to release
if possible?
推荐答案
我建议阅读以下有关Ivy多模块项目的教程。
I would suggest reading the following tutorial on multi-module projects in Ivy.
- http://ant.apache.org/ivy/history/latest-milestone/tutorial/multiproject.html
ANT构建传统上是大而且整体的。您需要做的是模仿Maven将大型项目分解成一系列较小版本的方式。每个子建筑将其工件发布到常春藤的本地回购中。
ANT builds traditionally are big and monolithic. what you need to do is emulate Maven's way of splitting a large project up into a series of smaller builds. Each sub-build publishes it's artifact into ivy's local repo.
常春藤对这种结构有很多有用的任务:
Ivy has lots of useful tasks for this kind of structure:
- < a href =http://ant.apache.org/ivy/history/latest-milestone/use/buildlist.html =nofollow> buildlist - 从整个主要构建文件中调用。用于查看每个子模块的ivy.xml并确定正确的构建顺序(某些模块依赖于其他模块)
- buildnumber - 查看已发布的内容,并按顺序生成下一个版本号。
- 发布 - 将工件推入本地回购(或一个外国人,如果在ivysettings.xml文件中配置)
- buildlist - Called from your overall main build file. Use to look into each sub-module's ivy.xml and determine the proper build order (Some modules depende on others)
- buildnumber - Looks at what is already published and generate the next build number in the sequence
- publish - Push artifacts into local repo (or a foreign one, if configured in the ivysettings.xml file)
这篇关于常春藤:使用动态修订的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!