如何包含 Ivy 依赖项而不包含任何依赖项? [英] How can I include the Ivy dependency and none of its dependencies?

查看:44
本文介绍了如何包含 Ivy 依赖项而不包含任何依赖项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去几周我一直在空闲时间试图让 Ivy 与 Ant 合作.我主要设置了它,但我遇到了依赖的障碍.

I have spent the last few weeks in off-time trying to get Ivy going with Ant. I have it set up mostly but I've run into a road-block with depenencies.

因为我使用 Ant,所以我有一个/lib 文件夹,其中包含我的应用程序使用的 32 个 jar 文件,一些是内部的,一些是专有的(我已将这两种类型都添加到我们的 Nexus)和一些开源.然后我在 Ivy.xml 文件中添加了 32 行依赖项.

Because I was using Ant I had a /lib folder with the 32 jar files that my app used, some in-house, some proprietary (I've added both of these types to our Nexus) and some Open Source. Then I added 32 dependency lines to my Ivy.xml file.

当我运行时,我得到它试图从 Nexus 拉下这些文件的大量依赖项,但我知道我不需要任何这些.所以我在每个依赖项中尝试了一个空的 <exclude> 标记,因为它默认为 *,但这似乎包括依赖项本身.有没有办法可以说排除此依赖项的所有依赖项但保留它"??

When I run, I get it trying to pull down LOTS of dependencies of those files from Nexus but I know I don't need ANY of these. So I tried an empty <exclude> tag in each dependency as this defaults to *, but this seems to include the dependency itself. Is there a way I can say "Exclude all dependencies of this dependency but leave it"??

Ivy 唯一不关心的部分是配置"的事情...我已经尝试阅读它好几次了,但是...如果我的答案在那里,请告诉我.谢谢.

The only part of Ivy I've stayed away from is the "Config" thing... I've tried to read up on it several times but... if my answer's in there, just let me know. Thanks.

推荐答案

以下是有关此主题的一些先前答案:

Here's some previous answers on this topic:

最简单的解决方案是在依赖中添加传递属性:

The simplest solution is to add the transitive attribute to the dependency:

<dependency org="foo" name="bar" revision="3.0" transitive="false"/>

如果您使用的是 Nexus 之类的 Maven 存储库,那么更好的解决方案是使用配置映射

If you're using a Maven repository like Nexus, then a better solution is to use a configuration mapping

<dependency org="foo" name="bar" revision="3.0" conf="default->master"/>

ivy 中的配置最初难以理解,但值得付出努力.我希望以下链接有帮助:

Configurations in ivy are tough to understand, initially, but well worth the effort. I hope the following links help:

这篇关于如何包含 Ivy 依赖项而不包含任何依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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