【问题标题】:Multiple artifacts of the module in Ivy常春藤模块的多个工件
【发布时间】:2012-12-23 03:32:42
【问题描述】:

我想通过 ivy 将 jar 检索到特定文件夹(如 lib),下面是我在 build.xml 中的检索定义:

<ivy:retrieve pattern="lib/[artifact].[ext]" conf="webInfLib" />

我的 ivy.xml 的定义如下:

<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"
       xmlns:m="http://ant.apache.org/ivy/maven">
    <info organisation="xxxx" module="xxxx" status="integration"/>
    <configurations>
        <conf name="webInfLib"  description="add jar to web-inf/lib folder"/>
    </configurations>
    <dependencies>
        <dependency org="org.springframework" name="spring-beans" rev="2.5.5" transitive="false" conf="webInfLib -> default"/>
        <dependency org="net.sf.json-lib" name="json-lib" rev="2.3"> 
            <artifact name="json-lib" type="jar" m:classifier="jdk15"/>
        </dependency>
    </dependencies>
</ivy-module>

但它总是抛出:

impossible to ivy retrieve: java.lang.RuntimeException: Multiple artifacts of the module xxxxxx are retrieved to the same file! Update the retrieve pattern  to fix this error.

我读过一些类似的问题,他们建议将检索模式更改为更复杂的模式。我尝试了类似“[artifact]-revision.[ext]”的东西,但没有帮助。当我执行“ivy.resolve”时,它可以正常工作。对这个问题有什么建议吗?

【问题讨论】:

    标签: build ivy


    【解决方案1】:

    检索模式是正确的问题。 你正在尝试

    [artifact]-[revision].ext
    

    所以我想二进制 jar 和源 jar 都将写入同一位置以用于任意依赖。但是,如果您为您所拥有的情况添加一些独特的东西

    [artifact]-[revision](-[classifier]).[ext]
    

    在源或文档的情况下,分类器会有一个值,因此会有一个不同的名称。如果没有分类器(如二进制编译 jar 的情况),则不会有任何分类器,这由括号 ( ) 处理

    【讨论】:

    • 感谢您的回复。您的分析是正确的,但解决方案没有帮助(我之前尝试过您的建议)。最后,我添加了 'type="jar"' 来检索标签,它可以工作。无论如何,再次感谢。
    • 把事情做好,这才是最重要的。但是作为最后的跟进,因为类型是导致问题的类型,您也可以将类型添加到模式中:[type]/[artifact]-[revision](-[classifier]).[ext]。这将使您的罐子与其他类型或工件一起使用
    • @EyadEbrahim 注意模式中的文件夹。如果添加 sync="true",此模式将删除 build.xml 所在的所有文件夹我认为该模式必须通过“${lib.path}/[type]/[artifact]-[revision](-[classifier]) .[ext]"
    猜你喜欢
    • 2011-08-19
    • 2015-10-04
    • 2011-04-12
    • 1970-01-01
    • 2013-12-19
    • 2015-08-27
    • 2016-02-15
    • 2012-10-09
    • 2012-03-01
    相关资源
    最近更新 更多