常春藤:如何删除传递依赖? [英] Ivy: how do I remove transitive dependencies?

查看:433
本文介绍了常春藤:如何删除传递依赖?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用常春藤来管理我的项目的依赖关系。

I'm using Ivy to manage the dependencies on my project.

到目前为止,我指定的休眠和servlet-API的依赖。然而,休眠罐子本身有很多未真正需要的相关性,比如 JAAS 并的jacc

So far, I've specified a dependency on Hibernate and servlet-api. However, the hibernate jar itself has a lot of dependencies that aren't really needed, such as jaas and jacc.

这成为一个表明,塞因为JAAS和JAAC都禁止将其放置在Maven的回购太阳库,因此它们的许可证,因此常春藤能容易找到他们。

This becomes a show-stopper because jaas and jaac are Sun libraries and therefore their licenses forbid to place them in the Maven repos, so Ivy can't find them there.


  • 如何让常春藤下载休眠但不是这两个?

  • 作为奖励,如果我真的需要那些并下载来自Sun的罐子,在哪个文件夹在我的机器将常春藤找他们?

推荐答案

如何让常春藤下载休眠但不是这两个?

常春藤做到这一点使用所谓的配置。你的的ivy.xml 的再presents Hibernate将需要提供不同的配置来重新present不同的使用情况进行休眠。 (有一些明显的使用Hibernate认为确实需要JAAS和JACC的,但显然你不使用的情况下)。

Ivy does this using what it calls "configurations." Your ivy.xml that represents Hibernate will need to provide different configurations to represent different use-cases for hibernate. (There is obviously some use of hibernate that does require jaas and jacc, but apparently you don't make use of that case.)

这里是配置的文档。如果你想提供的ivy.xml 您正在使用休眠,我可以提供建筑结构的指针,将删除特定的库,你想要移除。

Here is the documentation on configurations. If you want to provide the ivy.xml you are using for hibernate, I can provide pointers on building configurations that will remove the specific libraries you want removed.

如果我真正需要的,并下载来自Sun的罐子,在哪个文件夹在我的机器将常春藤找他们?

在目录常春藤看起来对常青藤文件和工件由您正在使用的解析器的列表中指定。在常青藤设置文件中指定解析器的列表(通常命名为 ivysettings.xml )。通常,这些都不是本地目录,但远程URL。有;然而,本地文件解析式,将这项工作。

The "directories" that ivy looks in for ivy files and artifacts are specified by the list of resolvers you are using. The list of resolvers is specified in the ivy settings file (usually named ivysettings.xml.) Typically, these aren't local directories, but remote URLs. There is; however, a local-file resolver type that will work for this.

如果你这样做,你需要同时提供常青藤文件和工件(罐),每相匹配的解析器模式,文件名。上细节的文件中。

If you do this, you will need to provide both ivy files and the artifacts (jars), each with file-names that match the resolvers patterns. Details on that are in the documentation.

下面是一个例子本地文件解析器从常青藤设置文件:

Here is an example local-file resolver from an ivy settings file:

<filesystem name="myfiles" checkconsistency="false" checksums="" transactional="false">
   <ivy pattern="/data/repo/[organisation]/[module]-[revision].ivy.xml"/>
   <artifact pattern="/data/repo/[organisation]/[module]-[revision].[ext]"/>
</filesystem>

另外请注意,您需要将您的ivy任务,以正确的解析。你可以在Ant任务Resolver属性做到这一点,或在设置 defaultResolver 属性中的元素常青藤设置文件。

Also note that you will need to point your ivy tasks to the correct resolver. You can do this with the resolver attribute on the ant tasks, or with the defaultResolver attribute on the settings element in the ivy settings file.

这里是解析器的文档。

编辑:的OP发现他的具体原来问题时较不密集的解决方法。依赖标签的排除子标签做的工作给他:

The OP found a less-time intensive workaround for his specific original problem. The "exclude" child-tag of the dependency tag did the job for him:

<dependencies>  
   <dependency org="org.hibernate" name="hibernate-core" rev="3.3.1.GA" conf='..'> 
       <exclude name='jaas' /> 
       <exclude name='jacc' />
   </dependency>
</dependencies>

这篇关于常春藤:如何删除传递依赖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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