蚂蚁依赖管理 [英] Ant dependency management

查看:23
本文介绍了蚂蚁依赖管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎蚂蚁依赖管理至少可以说不是很好......但是,有希望吗?今天有更好的构建或项目管理选择,例如 maven、ivy,但我坚持使用一堆相互依赖的 ant 项目,所以我想知道是否有管理依赖项的ant 最佳实践".

It seems that ant dependency management isn't great to say the least... But, is there hope? Today there are better choices for build or project management such as maven, ivy but I'm stuck with a bunch of ant project that depend on one another so I was wondering if there's an "ant best practice" for managing dependencies.

特别是在我的情况下,我有:

Specifically in my case I have:

w.war

a.jar
b.jar
c.jar

w.war 是我部署到 Web 服务器的 war 文件.在war文件中我使用a.jar.a.jar 依赖于 b.jar,所以我很高兴地将 b.jar 也打包到 w 中......这没什么,直到......当 b.jar 依赖于 c.jar 时,问题就开始了.a.jar 的作者知道它对 b.jar 的依赖,所以可以将 b.jar 打包成 w.war,但是不知道 b.jar 对 c.jar 的依赖.而且,b.jar 的作者以后可以添加更多的依赖项,例如b.jar 依赖于 e.jar",因此 a.jar 的作者没有机会在这些依赖项加起来时跟踪它们.

w.war is the war file I deploy to the web server. In the war file I use a.jar. a.jar depends on b.jar, so I happily package b.jar into w as well... That's sort of OK until... The problem starts when b.jar depends on c.jar. The author of a.jar knows about its dependency on b.jar so it can package b.jar into w.war, but it is not aware of the dependency of b.jar on c.jar. Moreover, the author of b.jar could later add even more dependencies such as "b.jar depends on e.jar", so the author of a.jar has no chance following these dependencies as they add up.

我想要的是定义a 依赖于 b"和b 依赖于 c"(在不同的 build.xml 文件中)并使用 ant magic 将它们全部编译为 w.war.那可能吗?如果没有,是否有最佳实践?

What I'd like to have is define "a depends on b" and "b depends on c" (in a different build.xml file) and use ant magic to compile them all into w.war. Is that possible? If not, is there a Best-Practice?

我已经很接近了,只是重写全部在 maven 中,但工作量很大... ant 有希望吗?

I'm this-close to just rewriting is all in maven, but it's a lot of work... Is there hope to ant?

推荐答案

如果您已经使用 Ant,那么您最好的选择是使用 Ivy 进行依赖管理.

If you already use Ant, then your best bet is to use Ivy for dependency management.

http://ant.apache.org/ivy/

它为依赖操作提供了丰富的 ant 任务集.

It provides a rich set of ant tasks for dependency manipulation.

这篇关于蚂蚁依赖管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆