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

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

问题描述

我正在使用常春藤来管理我的项目的依赖。

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

到目前为止,我已经指定了对Hibernate和servlet-api的依赖。但是,hibernate jar本身有很多不是真正需要的依赖项,例如 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是Sun图书馆,因此他们的许可证禁止将它们放在Maven回收站中,所以Ivy找不到他们。

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.


  • 如何让Ivy下载Hibernate但不是这两个?

  • 作为一个奖励,如果我真的需要那些并从Sun下载他们的Jars,我的机器中的哪个文件夹Ivy寻找他们?

推荐答案

如何让Ivy下载Hibernate不是这两个?

常春藤使用它所谓的配置。您代表Hibernate的 ivy.xml 将需要提供不同的配置来表示不同的hibernate用例。 (显然有一些使用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.)

这里是有关配置的文档。如果要提供用于hibernate的 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下载他们的Jars,我的机器中的哪个文件夹会由Ivy寻找他们?

ivy查找ivy文件和工件的目录由您使用的解析器列表指定。解决程序列表在常春藤设置文件(通常命名为 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.

如果这样做,您将需要提供两个常春藤文件和工件(jar),每个具有与解析器模式匹配的文件名。详细信息请参见文档。

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>

另请注意,您需要将您的常春藤任务指向正确的解析器。您可以使用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天全站免登陆