【问题标题】:How does Apache Ivy resolve the variables in artifact patterns provided in the ivysettings.xml file?Apache Ivy 如何解析 ivysettings.xml 文件中提供的工件模式中的变量?
【发布时间】:2010-10-15 17:32:47
【问题描述】:

如果我的 ivysettings.xml 文件包括:

<url name="com.springsource.repository.bundles.external">
    <ivy pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
    <artifact pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>

我的 ivy.xml 文件包括:

<dependency org="org.junit"
            name="com.springsource.org.junit" 
            rev="4.4.0" />

从我运行 Ivy 开始,我可以看出这会解析为:http://repository.springsource.com/ivy/bundles/external/org.junit/com.springsource.org.junit/4.4.0/com.springsource.org.junit-sources-4.4.0.jar

所以决议去:

[organization] => "org.junit"
[module] => "com.springsource.org.junit"
[revision] => "4.4.0"
[artifact] => "com.springsource.org.junit-sources"
[ext] => "jar"

我看到了 ivy 如何解析 URL 模式中的 [organisation]、[module] 和 [revision] (duh),但它如何解析 [artifact] 和 [ext]?

documentation on the URL resolver 好像少了。

【问题讨论】:

    标签: java ant ivy dependency-management


    【解决方案1】:

    Ivy 首先解析&lt;ivy pattern... /&gt;,并给出组织、模块和修订版本,并将[artifact] 硬编码为“ivy”,[ext] 硬编码为“xml”。这会产生一个 URL,在这种情况下:

    http://repository.springsource.com/ivy/bundles/external/org.junit/com.springsource.org.junit/4.4.0/ivy-4.4.0.xml

    这是该模块的 ivy 配置文件。除其他外,此 ivy 配置文件包含有关其他工件的信息,特别是:

    <artifact name="com.springsource.org.junit-sources" type="src" ext="jar"/>
    <artifact name="license" type="license" ext="txt"/>
    

    这两个然后用于完成&lt;artifact pattern... /&gt; 部分 - 下载许可证和下载 jar 文件。

    【讨论】:

      猜你喜欢
      • 2012-09-09
      • 2010-12-24
      • 2011-11-09
      • 1970-01-01
      • 1970-01-01
      • 2017-09-11
      • 1970-01-01
      • 2018-02-14
      • 2011-11-13
      相关资源
      最近更新 更多