You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Jim Garrison <Ji...@troux.com> on 2009/05/22 20:34:34 UTC

Maven "classifier" ==> Ivy "?"

A Maven dependency defines groupId, artifactId, version and "classifier".

The first three map top Ivy's organization, name and revision.  What name does Ivy use for the "classifier"?

Specifically, I have

        <dependency org="commons-lang" name="commons-lang" rev="2.0"/>
which is downloading both the jar (which I want) and sources (which I don't need).  How do I exclude the sources?

RE: Maven "classifier" ==> Ivy "?"

Posted by Jim Garrison <Ji...@troux.com>.
> -----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 :-)

Re: Maven "classifier" ==> Ivy "?"

Posted by Garima Bathla <ga...@gmail.com>.
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](-[classifier]).[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.


On Fri, May 22, 2009 at 11:34 AM, Jim Garrison <Ji...@troux.com>wrote:

> A Maven dependency defines groupId, artifactId, version and "classifier".
>
> The first three map top Ivy's organization, name and revision.  What name
> does Ivy use for the "classifier"?
>
> Specifically, I have
>
>        <dependency org="commons-lang" name="commons-lang" rev="2.0"/>
> which is downloading both the jar (which I want) and sources (which I don't
> need).  How do I exclude the sources?
>