Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ivy Retrieve with Classifiers

Tags:

ivy

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.

like image 702
David W. Avatar asked Dec 20 '22 06:12

David W.


1 Answers

Use parentheses to specify optional components of an attribute pattern:

<ivy:retrieve 
     pattern="${lib.dir}/[artifact](-[classifier])-[revision].[ext]"
     conf="runtime"/>
like image 165
Mark O'Connor Avatar answered Dec 22 '22 20:12

Mark O'Connor