问题描述
我正在使用Ivy来管理我的依赖项,在提供的jar上存在一些问题
I'm using Ivy to manage my dependencies, with some problems on provided jars
这是我的ivy.xml文件
This is my ivy.xml file
<configurations>
<conf name="local" visibility="private" />
<conf name="compile" description="used for building" />
<conf name="test" extends="compile" description="used for testing" />
<conf name="runtime" description="used for running" />
<conf name="master" description="used for publishing" />
<conf name="default" extends="master, runtime" />
</configurations>
<dependencies>
<dependency org="xalan" name="xalan" rev="2.7.1"/>
<dependency org="org.w3c.css" name="sac" rev="1.3"/>
<dependency org="com.lowagie" name="itext" rev="2.0.8">
<exclude org="bouncycastle"/>
</dependency>
<!--Provided-->
<dependency org="javax.ejb" name="ejb-api" rev="3.0" conf="compile"/>
<dependency org="javax.jms" name="jms-api" rev="1.1-rev-1" conf="compile"/>
</dependencies>
Ejb和jms由容器提供
Ejb and jms are provided by the container
执行后我得到
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| compile | 8 | 0 | 0 | 0 || 6 | 0 |
| default | 6 | 0 | 0 | 0 || 6 | 0 |
---------------------------------------------------------------------
所以Ivy很好地解决了依赖性,但是当我执行此操作时
So Ivy is getting fine the dependencies but when I execute this
<ivy:cachepath pathid="normal.classpath" />
<pathconvert property="expanded.normal.classpath" refid="normal.classpath"/>
<echo message="${expanded.normal.classpath}" file="normal.classpath.txt"/>
<ivy:cachepath conf="compile" pathid="compile.classpath" />
<pathconvert property="expanded.compile.classpath" refid="compile.classpath"/>
<echo message="${expanded.compile.classpath}" file="compile.classpath.txt"/>
两个类路径都相同。
有人知道为什么吗?
Both classpath are the same.Anyone knows why?
推荐答案
第一个 ivy:cachepath
没有定义conf,它可以解析所有配置,因此包含每个模块。
The first ivy:cachepath
has no conf defined, to it resolve all configurations, so every module is included.
第二个 ivy:cachepath
仅请求conf编译。因此,声明为 conf = compile
的依赖项( conf = compile-> compile
的同义词)显然包括在内。并且还包括没有任何 conf
属性的依赖项,因为默认的conf是 *-> *
。
The second ivy:cachepath
is requesting only the conf compile. So the dependencies which are declared as conf="compile"
(synonymous of conf="compile->compile"
) are obviously included. And the dependencies without any conf
attribute are also included, because the default conf is *->*
.
有关依赖项配置的更多文档:
More documentation about configurations on dependencies:
- "Configurations mapping" in http://ant.apache.org/ivy/history/latest-milestone/ivyfile/dependency.html
defaultconf
attribute in http://ant.apache.org/ivy/history/latest-milestone/ivyfile/dependencies.html
这篇关于Apache Ivy和配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!