简体   繁体   English

如何使用Apache Ivy解决多个文件的依赖关系?

[英]How to use Apache ivy to resolve dependency with multiple files?

Here is my ivy.xml: 这是我的ivy.xml:

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0">
...
<dependencies>
    <dependency org="spring" name="richclient" rev="1.1.0"/>
</dependencies>
</ivy-module>

And ivy-settings.xml: 和ivy-settings.xml:

<property name="ivy.local.default.root"             value="/home/---/dev/Java/_libraries/_ivy" override="false"/>
<property name="ivy.local.default.ivy.pattern"      value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="false"/>
<property name="ivy.local.default.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="false"/>
<resolvers>
    <filesystem name="local">
        <ivy pattern="${ivy.local.default.root}/${ivy.local.default.ivy.pattern}" />
        <artifact pattern="${ivy.local.default.root}/${ivy.local.default.artifact.pattern}" />
    </filesystem>
</resolvers>

Ivy try to find /home/---/dev/Java/_libraries/_ivy/spring/richclient/1.1.0/jars/richclient.jar 常春藤尝试找到/home/---/dev/Java/_libraries/_ivy/spring/richclient/1.1.0/jars/richclient.jar

And here is the problem. 这就是问题所在。 Library has 4 jar files. 图书馆有4个jar文件。

How to include all jars in project from one dependency in ivy.xml? 如何从ivy.xml中的一个依赖项将项目中的所有jar都包含在内?

Thx 谢谢

I'm assuming you've just downloaded the jars locally? 我假设您刚刚在本地下载了jars? It won't work unless you also write an ivy.xml file for the downloaded files, listing the artifacts that are associated with the module (See publications section of the ivy.xml doco) 除非您还为下载的文件编写一个ivy.xml文件,并列出与该模块关联的工件,否则它将不起作用(请参阅ivy.xml doco的出版物部分)

Why not avoid the hassle of maintaining the your own version of someone else's module by using the maven repository provided by Spring? 为什么不通过使用Spring提供的Maven存储库来避免维护自己的其他模块版本的麻烦呢?

Add the following to your ivy-settings.xml file: 将以下内容添加到您的ivy-settings.xml文件中:

<resolvers>
    <ibiblio name="spring-rcp" m2compatible="true" root="http://spring-rich-c.sourceforge.net/maven2repository"/>
</resolvers>

While Ivy can work using dependencies on individual JAR files, it works better if you define separate ivy.xml files for the dependencies themselves, which specifies the 4 separate JAR files. 尽管Ivy可以使用单个JAR文件上的依赖项来工作,但如果为依赖项本身定义了单独的ivy.xml文件(它指定了4个单独的JAR文件),则效果更好。 This ivy.xml defines what Ivy calls a module. 这个ivy.xml定义了Ivy所谓的模块。

Your application's ivy.xml then expresses a dependency on that module, rather than on specific JAR files. 然后,应用程序的ivy.xml表示对该模块的依赖性,而不是对特定JAR文件的依赖性。

The Ivy website has a tutorial on modules, I highly recommend reading it 常春藤网站上有关于模块的教程,我强烈建议阅读

http://ant.apache.org/ivy/history/latest-milestone/tutorial/conf.html http://ant.apache.org/ivy/history/latest-milestone/tutorial/conf.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM