使用 ant 处理数百个依赖项
我必须重构 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许我误解了这个问题,但是您不能使用每个依赖项的名称定义 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.
我建议考虑使用依赖管理工具,例如 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.