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 imihov <im...@linkedin.com> on 2009/05/11 19:21:54 UTC

Settings & configuration for retrieving artifacts with classifier (javadoc, src, etc.)

Hi,

I am sure this problem has been addressed below, however, I could not find a
well documented solution, hence my question.

I would like to be able to retrieve artifacts with a "classifier" in their
name in addition to the main artifact (like the example below):

 apache-tomcat-6.0.18.tar.gz
 apache-tomcat-6.0.18-src.tar.gz
 apache-tomcat-6.0.18-deployer.tar.gz

The same case holds for regular JAR artifacts:

 foo-1.2.5.jar
 foo-1.2.5-src.jar
 foo-1.2.5-javadoc.jar
 foo-1.2.5-test.jar

I am interested in having separate configurations to retrieve individual
artifacts. I would also like to preserve the full artifact name in the local
cache, if possible.

If anyone has done something like this, I am particularly interested in the
ivysettings.xml file (resolvers, caches, modules, etc.).

Thanks,
--ivo
-- 
View this message in context: http://www.nabble.com/Settings---configuration-for-retrieving-artifacts-with-classifier-%28javadoc%2C-src%2C-etc.%29-tp23487693p23487693.html
Sent from the ivy-user mailing list archive at Nabble.com.


Re: Settings & configuration for retrieving artifacts with classifier (javadoc, src, etc.)

Posted by imihov <im...@linkedin.com>.


cpslo1999 wrote:
> 
> (Full disclosure: I'm new to Ivy as well, so maybe one of the gurus can
> chime in and verify this)
> 
> You have both "type" and "classifier" attributes at your disposal. In your
> 
> 

Well, I agree about having "type" by default, but that does not seem to be
the case for "classifier". I was able to find this post where Xavier suggest
using an extra namespace to introduce the extra "classifier" attribute:

http://mail-archives.apache.org/mod_mbox/ant-ivy-user/200804.mbox/%3C635a05060804170035x47b50632l2dcca19e2611b644@mail.gmail.com%3E

I am not sure if I am missing something here.

Basically what I have so far is:

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module 
  version="2.0" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:e="http://ant.apache.org/ivy/extra">
  
  <info organisation="org.apache.tomcat" module="apache-tomcat"
revision="6.0.18"/>
  
  <configurations>
    <conf name="default" visibility="public" description="Default
configuration maps to master (the artifact itself)." extends="master"/>
    <conf name="master" visibility="public" description="Contains the
artifact published by this module itself, with no transitive dependencies"/>
    <conf name="source" visibility="public" description="Contains the source
artifact of this module, if any."/>
    <conf name="deployer" visibility="public" description="Contains the
Tomcat Deployer."/>
  </configurations>
  
  <publications>
    <artifact name="apache-tomcat" type="distro" ext="tar.gz"
conf="master"/>
    <artifact name="apache-tomcat" e:classifier="src" type="src"
ext="tar.gz" conf="source"/>
    <artifact name="apache-tomcat" e:classifier="deployer" type="distro"
ext="tar.gz" conf="deployer"/>
  </publications>
</ivy-module>


My Ivy settings file:

<ivysettings>
  
  <settings defaultResolver="default"/>
  
  
  <resolvers>
    <filesystem name="sandbox-repo" m2compatible="true">
      <ivy
pattern="/Users/imihov/work/eclipse/workspace/network_BR_ENG_KNL_TC6/sandbox-repo/[organisation]/[module]/[revision]/[module]-[revision].ivy"
/>
      <artifact
pattern="/Users/imihov/work/eclipse/workspace/network_BR_ENG_KNL_TC6/sandbox-repo/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
    </filesystem>

    <chain name="default">
      <resolver ref="sandbox-repo"/>
    </chain>
  </resolvers>
  
</ivysettings>
Thanks,
--ivo
-- 
View this message in context: http://www.nabble.com/Settings---configuration-for-retrieving-artifacts-with-classifier-%28javadoc%2C-src%2C-etc.%29-tp23487693p23491864.html
Sent from the ivy-user mailing list archive at Nabble.com.


Re: Settings & configuration for retrieving artifacts with classifier (javadoc, src, etc.)

Posted by Joshua Tharp <jo...@alumni.calpoly.edu>.
(Full disclosure: I'm new to Ivy as well, so maybe one of the gurus can
chime in and verify this)

You have both "type" and "classifier" attributes at your disposal. In your
ivy file you can say that you only want type "jar" or type "src", whatever.
You can also specify type in your resolve Ant task. If you have a single
build that produces two artifacts of type "jar" then you would use the
classifier to distinguish between them so that you don't end up with a name
collision. For example, if you have a build that produces a client API and
implmentation, your publish section of your ivy file would need to list one
of them with a classifier. With a classifier you could have both
myjar-1.0.jar and myjar-1.0-client.jar.

Josh

On Mon, May 11, 2009 at 11:09 AM, imihov <im...@linkedin.com> wrote:

>
> Unfortunately, I cannot find anything in the Ivy documentation on usage of
> the 'classifier' pattern/attribute. I see in the code that it is used in
> the
> POM parser/reader, but nothing outside of that.
>
> Let's say that I had the above pattern in my settings file. How would I
> tell
> Ivy to retrieve the 'src' artifact? How would I map the configuration to
> it?
>
> Thanks,
> --ivo
> --
> View this message in context:
> http://www.nabble.com/Settings---configuration-for-retrieving-artifacts-with-classifier-%28javadoc%2C-src%2C-etc.%29-tp23487693p23488546.html
> Sent from the ivy-user mailing list archive at Nabble.com.
>
>

Re: Settings & configuration for retrieving artifacts with classifier (javadoc, src, etc.)

Posted by imihov <im...@linkedin.com>.
Unfortunately, I cannot find anything in the Ivy documentation on usage of
the 'classifier' pattern/attribute. I see in the code that it is used in the
POM parser/reader, but nothing outside of that.

Let's say that I had the above pattern in my settings file. How would I tell
Ivy to retrieve the 'src' artifact? How would I map the configuration to it?

Thanks,
--ivo
-- 
View this message in context: http://www.nabble.com/Settings---configuration-for-retrieving-artifacts-with-classifier-%28javadoc%2C-src%2C-etc.%29-tp23487693p23488546.html
Sent from the ivy-user mailing list archive at Nabble.com.


Re: Settings & configuration for retrieving artifacts with classifier (javadoc, src, etc.)

Posted by Joshua Tharp <jo...@alumni.calpoly.edu>.
The pattern you are looking for is {whatever path stuff you
want}/[module]-[revision](-[classifier]).[ext]

On Mon, May 11, 2009 at 10:21 AM, imihov <im...@linkedin.com> wrote:

>
> Hi,
>
> I am sure this problem has been addressed below, however, I could not find
> a
> well documented solution, hence my question.
>
> I would like to be able to retrieve artifacts with a "classifier" in their
> name in addition to the main artifact (like the example below):
>
>  apache-tomcat-6.0.18.tar.gz
>  apache-tomcat-6.0.18-src.tar.gz
>  apache-tomcat-6.0.18-deployer.tar.gz
>
> The same case holds for regular JAR artifacts:
>
>  foo-1.2.5.jar
>  foo-1.2.5-src.jar
>  foo-1.2.5-javadoc.jar
>  foo-1.2.5-test.jar
>
> I am interested in having separate configurations to retrieve individual
> artifacts. I would also like to preserve the full artifact name in the
> local
> cache, if possible.
>
> If anyone has done something like this, I am particularly interested in the
> ivysettings.xml file (resolvers, caches, modules, etc.).
>
> Thanks,
> --ivo
> --
> View this message in context:
> http://www.nabble.com/Settings---configuration-for-retrieving-artifacts-with-classifier-%28javadoc%2C-src%2C-etc.%29-tp23487693p23487693.html
> Sent from the ivy-user mailing list archive at Nabble.com.
>
>