ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Garrison <Jim.Garri...@troux.com>
Subject RE: Maven "classifier" ==> Ivy "?"
Date Fri, 22 May 2009 19:26:12 GMT
> -----Original Message-----
> From: Garima Bathla [mailto:garima.bathla@gmail.com] 
> Sent: Friday, May 22, 2009 1:58 PM
> To: ivy-user@ant.apache.org
> Subject: Re: Maven "classifier" ==> Ivy "?"
> 
> Interesting question and I just bumped into an answer for 
> this question last night in my own little research.
> 
> In IVY there is a concept of classifier , but this is only 
> valid within a dependency - and you have to map classifier to 
> your namespace to make sure ivy.xsd doesn't complains about 
> malformed xml
> 
> So to precisely solve your problem you will have to do the following :
> 
> 1. Change the resolver artifact pattern to  include 
> classifier in it - this will help ivy to replace a classifier 
> with a value from ivy.xml if it exists , if it doesn't it 
> will be ignored (anything in parenthesis is optional).
> 
> 
> [organisation]/[module]/[revision]/[artifact]-[revision](-[cla
> ssifier]).[ext]
> 
> 2.  Change your module descriptor such that you explicityly 
> mention that you do not want to download source, but only binaries:
> 
>    <dependency org="commons-lang" name="commons-lang" rev="2.0">
>       <artifact name="commons-lang" type="jar"/>
>      <!-- <artifact name="common-lang" type="source" ext="jar"
> m:classifier="sources"/> --> -- This is exactly you should 
> not have in your ivy.xml
>   </dependency>
> 
> So this way of writing ivy.xml tells ivy explicitly what to 
> do with classifier - in this case since you will not be using 
> it ivy will only download artifacts of type-> jar and not ALL.


That works, however it was not necessary to change the dependency.
Just changing the pattern appears to make it ignore anything with 
a classifier unless the classifier is explicitly requested.

For reference, here's my ivysettings.xml.  Nothing changed in ivy.xml

<ivysettings>
  <settings defaultResolver="public"/>
  <caches defaultCacheDir="${ivy.settings.dir}/cache"/>
  <resolvers>
    <ibiblio name="public" 
            m2compatible="true" 
            usepoms="false" 
            root="http://devlinux01:8081/nexus/content/groups/public"
            pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
  </resolvers>
</ivysettings>

Thanks for the quick response.  For an apparently low-traffic list,
getting helpful answers in minutes is amazing! I hope I can contribute
as my knowledge increases :-)

Mime
View raw message