使用 ant 处理数百个依赖项

发布于 2024-08-31 20:22:57 字数 328 浏览 2 评论 0原文

我必须重构 ant xml 文件。基本上,我有一项大任务,即检查(使用 cvs)大量依赖项,构建它们,然后将通过构建它们生成的所有 jar/wsdl 复制到我指定的目录。如果一个依赖项版本发生更改,我必须更改 xml 文件中至少 3 个位置的名称(cvs checkout、build、copy)。

我想要的只是一个可以指定我的依赖项名称的地方,而无需搜索和查找。通过代码替换依赖名称。

问题之一是 cvs 项目可能是 /path1/path2/project 且 tag=v12,但是单个项目构建生成的 jar 可能是多个具有不同名称的文件,因此看起来有点复杂。

你知道我该如何完成这件事吗?

I have to refactor an ant xml file. Basicly I have one big task that checkouts (using cvs) a lot of dependencies, build them, and then copy all the jar/wsdl generated by building them to a directory that I specify. If one dependency version changes, I have to change the name in at least 3 places on the xml file (cvs checkout, build, copy).

What I'd like to have is just a single place where I can specify my dependencies name, without having to search & replace the dependency name through the code.

One of the problems is that the cvs project could be /path1/path2/project with tag=v12 but then the jars generated by the single project build could be several with different names, so it seems to be a bit complicated.

Do you have any idea on how I can get this done?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

哆啦不做梦 2024-09-07 20:22:57

也许我误解了这个问题,但是您不能使用每个依赖项的名称定义 Ant 属性并在 3 个位置使用该属性吗?然后,当版本发生更改时,您只需更新属性值即可。

Maybe I'm misunderstanding the question, but can't you define Ant properties with each dependency's name and use the property in the 3 places? Then you just update the property value when there is a version change.

陪你到最终 2024-09-07 20:22:57

我建议考虑使用依赖管理工具,例如 ivy

使用版本化存储库将使您能够将大型整体构建分解为较小的子项目。

Ivy 还与为其他开源项目维护的 maven 中央存储库集成,这意味着您不必再将它们的 jar 提交到您的 SCM 中,只需在您的 ivy.xml 文件中引用它们即可。

I'd recommend considering using a dependency management tool like ivy.

The use of a versioned repository will enable you to break up a large monolithic build into smaller sub-projects.

Ivy also inetgrates with the maven central repositories maintained for other open source projects which means you won't have to commit their jars into your SCM anymore, just reference them in your ivy.xml file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文