How can I include the Ivy dependency and none of its dependencies?

给你一囗甜甜゛ 提交于 2019-12-12 21:07:14

问题


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.

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.

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"??

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.


回答1:


Here's some previous answers on this topic:

  • IVY - Set the default transitive value
  • How to copy runtime libraries without the provided ones in IVY

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

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

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"/>

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

  • Ivy, what is the master configuration and why is it not pulling jvyaml?
  • How are maven scopes mapped to ivy configurations by ivy


来源:https://stackoverflow.com/questions/22150359/how-can-i-include-the-ivy-dependency-and-none-of-its-dependencies

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!