Ivy中模块的多个工件

时间:2013-01-09 06:10:50

标签: build ivy

我想通过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”时,它会被罚款。关于这个问题有什么建议吗?

1 个答案:

答案 0 :(得分:4)

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

[artifact]-[revision].ext

所以我认为二进制jar和源jar都会写在同一个位置上,用于任意依赖。但是,如果你添加一些独特的东西

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

对于源或doc,分类器将具有值,因此具有不同的名称。如果没有分类器(如二进制编译jar的情况),将不会有任何分类器,这由括号()处理