当我使用ivy.xml for Red5 (或其他任何项目)中的依赖项时,我只想检索库jar。无论我如何配置它,我仍然可以获得用于依赖关系的“源”jars。我已经浏览了文档和google,还没有找到一个使用Ivy 2.2.0的解决方案。
我的ivy.xml中的这组节点似乎对大多数库最有效,但是Spring忽略了它们。
<exclude ext="txt" />
<exclude type="src" />
<exclude artifact="!sources" />如果有人有任何有用的提示,让我们听听吧!!
链接到源xml文件
http://red5.googlecode.com/svn/java/server/trunk/ivy.xml
http://red5.googlecode.com/svn/java/server/trunk/ivysettings.xml
http://red5.googlecode.com/svn/java/server/trunk/build.xml
Note
不要说这是重复的,他们的答案是行不通的:
更新1
<dependency org="org.springframework" name="org.springframework.core" rev="3.0.5.RELEASE" transitive="false" />在我的lib目录中生成这两个文件:
org.springframework.core-3.0.5.RELEASE.jar
org.springframework.core-sources-3.0.5.RELEASE.jar对于更新2,我希望您的解决方案可以使用每个人都可以作为开放源代码使用的Red5主干。这些资料罐对我来说只是一件烦人的事,非常值得赏金。
发布于 2011-08-18 05:02:37
我建议不要使用,在依赖声明中使用“传递”属性,而是尝试使用配置来解决问题。
常春藤中的配置在功能上与Maven中的作用域相同,但要灵活得多。
我通常在代码中声明至少以下3种配置
<configurations>
<conf name="compile" description="Compile time dependencies"/>
<conf name="runtime" description="Compile time dependencies" extends="compile"/>
<conf name="test" description="Compile time dependencies" extends="runtime"/>
</configurations>对应于任何java项目所需的3组依赖项。
秘诀是如何将依赖关系映射到配置。如果您只希望jar没有它的依赖项,那么按如下方式声明它:
<dependency org="org.springframework" name="org.springframework.core" rev="3.0.5.RELEASE" conf="compile->master"/>映射到远程Maven模块主范围的本地编译配置。Maven中的主作用域排除了任何传递依赖项。
如果您希望工件包含它的传递依赖项,那么按照以下方式声明配置映射:
<dependency org="org.springframework" name="org.springframework.core" rev="3.0.5.RELEASE" conf="compile->default"/>工作ivy.xml文件
这将下载一个罐子。
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info organisation="red5" module="server" />
<configurations>
<conf name="default"/>
<conf name="java6" extends="default" description="Java 6 dependencies"/>
<conf name="utest" extends="eclipse" description="Unit testing dependencies"/>
<conf name="eclipse" description="Special dependencies in Eclipse"/>
</configurations>
<dependencies>
<dependency org="org.springframework" name="org.springframework.core" rev="3.0.5.RELEASE" conf="default->master"/>
</dependencies>
</ivy-module>修改后的设置文件
我还建议使用 Maven 解析器,该解析器旨在理解Maven 1和Maven 2存储库格式:
<ivysettings>
<settings defaultResolver="local"/>
<resolvers>
<chain name="local">
<ibiblio name='springsource-releases' m2compatible='true' root='http://repository.springsource.com/maven/bundles/release'/>
..
..
</chain>
</resolvers>
</ivysettings>注意,我正在使用Springsource存储库,它更有可能是最新的。我不知道他们是否正确地维护了旧的常春藤储存库。
https://stackoverflow.com/questions/7046198
复制相似问题