在Ivy中找到隐藏的依赖项 [英] Find hidden dependencies in Ivy
问题描述
我正在使用Apache Ivy + IvyDE来获取项目的依赖项,它们是:
I'm using Apache Ivy + IvyDE for getting my project's dependencies, which are:
<dependency org="com.google.guava" name="guava" rev="r08" />
<!-- logging -->
<dependency org="org.slf4j" name="jcl-over-slf4j" rev="1.6.1" />
<dependency org="ch.qos.logback" name="logback-classic" rev="0.9.27" />
<!-- database -->
<dependency org="org.hibernate" name="hibernate-entitymanager" rev="3.6.2.Final" />
<dependency org="org.hibernate" name="hibernate-validator" rev="4.1.0.Final" />
<dependency org="org.hibernate" name="hibernate-c3p0" rev="3.6.2.Final" />
<dependency org="mysql" name="mysql-connector-java" rev="5.1.14" />
来源是Maven和JBoss(Hibernate)存储库。
Sources are the Maven and JBoss (Hibernate) repositories.
正如你所看到的,我正在使用logback + SLF4J进行日志记录,但由于某种原因,Ivy也会下载log4j和slf4j-log4j,这会在我的应用程序中引起一些小问题。
As you can see I'm using logback+SLF4J for logging, but for some reason Ivy will download log4j and slf4j-log4j as well, which causes a few small problem in my application.
有没有办法看到为什么会发生这种情况,看看上面哪些依赖项依赖于log4j?我可以获得从Ivy / IvyDE生成的依赖图/树吗?
Is there a way to see why this happens, to see which of the dependencies above depend on log4j? Can I get a dependency graph/tree generated from Ivy/IvyDE?
那么有没有办法防止这种情况发生?
And is there then a way to prevent this from happening?
推荐答案
我们有一个蚂蚁目标,如下所示:
We have an ant target that looks like this:
<target name="report" depends="init">
<mkdir dir="report" />
<!--
The type attribute is optional, we're using it to exlude other dependcy types we're not interested in.
Note that each resolve uses that list (via a property) in our build.
-->
<ivy:resolve type="jar,ejb,tld,bundle"/>
<ivy:report todir="report" />
</target>
然后它只是一个电话蚂蚁报告
和Ivy将在给定目录中以HTML格式生成报告。
Then it's just a call ant report
and Ivy will generate the report as HTML in the given directory.
查看常春藤常春藤文档:报告。
编辑:
为防止包含这些工件/依赖项,您可以在上尝试
元素,或使用 transitive =false
< dependency ...> < exclude>
。例如,我们使用Hibernate 3但不想拥有 JTA 1.1
,所以我们的 ivy.xml
包含这个:< exclude module =jta/>
以排除所有可传递的JTA依赖项。
To prevent the inclusion of those artifacts/dependencies, you could try transitive="false"
on the <dependency ..>
element, or use <exclude>
. For example, we use Hibernate 3 but don't want to have JTA 1.1
, so our ivy.xml
containts this: <exclude module="jta"/>
to exclude all transitive JTA dependencies.
这篇关于在Ivy中找到隐藏的依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!