Ivy Retrieve with Classifiers

流过昼夜 提交于 2019-12-07 07:55:01

问题


I have the following ivy.xml:

<ivy-module version="1.0"
    xmlns:maven="http://maven.apache.org">

    <configurations>
    ...
    </configurations>

    <dependencies>
        <dependency org="com.foo"   name="fubur"
            rev="1.3"    conf="runtime->default"/>
        <dependency org="com.snafu" name="barfu"
            rev="1.4"    conf="runtime->default">
            <artifact name="barfu" 
                maven:classifier="ID_10T" 
                type="jar" ext="jar"/>
        </dependency>
    </dependencies>
</ivy-module>

In my build.xml, I want to retrieve all of my jars for the war I'm building:

  <ivy:retrieve 
     pattern="${lib.dir}/[artifact]-[classifier]-[revision].[ext]"
     conf="runtime"/>

No, that won't work... There's no classifier in fubar-1.3.jar. It will download as fubar--1.3.jar

  <ivy:retrieve 
     pattern="${lib.dir}/[artifact]-[revision].[ext]"
     conf="runtime"/>

That's no good either. barfu-ID_10T-1.4.jar will download as barfu-1.4.jar.

I would like the jars in my war to be included as barfu-ID_10T-1.4.jar and fubar-1.3-jar`. Is there an easy way of doing that? I know I could create two different configurations, but that is overkill. I'd rather just have the jars miss-named since it really doesn't affect the war itself.


回答1:


Use parentheses to specify optional components of an attribute pattern:

<ivy:retrieve 
     pattern="${lib.dir}/[artifact](-[classifier])-[revision].[ext]"
     conf="runtime"/>


来源:https://stackoverflow.com/questions/16344151/ivy-retrieve-with-classifiers

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!