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 Romain Pelisse <be...@gmail.com> on 2011/01/04 18:24:57 UTC

Using Ivy to download zip files from a Maven repository (nexus)

Hi Ivy users,

I used Ivy as part of my deployment tools. Our apps are packaged as zip
files and Ivy fetches them from a maven repository. So I have an ivysettings
.xml file where I declare our local repository:

<ivysettings>


  <settings defaultResolver="my-company" />


  <resolvers>


    <chain name="my-company">


      <url name="my-company">


        <ivy pattern="http://
my-company.repo/nexus/content/repositories/hosted-snapshot/com/my-company/[module]_2.8.0/[revision]/[artifact]-[revision].zip"
/>
        <artifact pattern="http://
my-company.repo/nexus/content/repositories/hosted-snapshot/com/my-company/[module]_2.8.0/[revision]/[artifact]-[revision].zip"
/>
      </url>
...

(look like a hack  if you ask me - especially the hard coded url prefix
'com/my-company' and the hard coded file type, but it was the only I find to
have this working)

And then I have such a configuration in the ivy.xml file:

<dependencies>


  <dependency org="my-company" name="apps" rev="0.2.0-SNAPSHOT"/>


</dependencies>

Because of the "hackyness" feeling I get from the ivy-settngs.xml.

Am I missing something here ? Did I misunderstand the XML semantics of Ivy
and end up writing a rather bizarre configuration ?

-- 
Romain PELISSE,
*"The trouble with having an open mind, of course, is that people will
insist on coming along and trying to put things in it" -- Terry Pratchett*
http://belaran.eu/wordpress/belaran

Re: Using Ivy to download zip files from a Maven repository (nexus)

Posted by Romain Pelisse <be...@gmail.com>.
Thanks for your answer, Nicolas - sorry I was not able to react in time, it
took longer than I expected to get back to this issue.

I added the change proposed by Nicolas and now I can indeed use properly the
[organisation] placeholder instead of an hard coded 'my.company'.

Also, to "unhardcoded" the extension type (ext), I apply the following
strategy :

  <resolvers>
    <chain name="my-company">
      <url name="my-company">
        <ivy pattern="
http://repo.corp.my.company/nexus/content/repositories/hosted-snapshot/[organisation]/[module]_2.8.0/[revision]/[artifact]-[revision].[ext]"
/>
        <artifact pattern="
http://repo.corp.my.company/nexus/content/repositories/hosted-snapshot/[organisation]/[module]_2.8.0/[revision]/[artifact]-[revision].[ext]"
/>
      </url>
    </chain>
  </resolvers>

And I configure the file extension on the dependencies:

<dependencies>
 <dependency org="my.company" name="app1" rev="0.2.0-SNAPSHOT">
   <artifact name="app1" type="zip"/>
 </dependency>
 <dependency org="my.company" name="app2" rev="0.3.2-SNAPSHOT">
   <artifact name="app2" type="zip"/>
 </dependency>
</dependencies>

Now, I feel my Ivy configuration is "clean". If some of you disagree, please
let me know :)

Thanks for the help !

2011/1/4 Nicolas Lalevée <ni...@hibnet.org>

>
> Le 4 janv. 2011 à 18:24, Romain Pelisse a écrit :
>
> > Hi Ivy users,
> >
> > I used Ivy as part of my deployment tools. Our apps are packaged as zip
> > files and Ivy fetches them from a maven repository. So I have an
> ivysettings
> > .xml file where I declare our local repository:
> >
> > <ivysettings>
> >
> >
> >  <settings defaultResolver="my-company" />
> >
> >
> >  <resolvers>
> >
> >
> >    <chain name="my-company">
> >
> >
> >      <url name="my-company">
> >
> >
> >        <ivy pattern="http://
> >
> my-company.repo/nexus/content/repositories/hosted-snapshot/com/my-company/[module]_2.8.0/[revision]/[artifact]-[revision].zip"
> > />
> >        <artifact pattern="http://
> >
> my-company.repo/nexus/content/repositories/hosted-snapshot/com/my-company/[module]_2.8.0/[revision]/[artifact]-[revision].zip"
> > />
> >      </url>
> > ...
> >
> > (look like a hack  if you ask me - especially the hard coded url prefix
> > 'com/my-company' and the hard coded file type, but it was the only I find
> to
> > have this working)
>
> You should set the m2compatible attribute to true, it will transform the
> dots into slashes:
> http://ant.apache.org/ivy/history/latest-milestone/resolver/url.html
> Then your pattern would look like:
>
> http://my-company.repo/nexus/content/repositories/hosted-snapshot/[organisation]/[module]_2.8.0/[revision]/[artifact]-[revision].[ext]
>
> I don't know what "2.8.0" stands for since it seems different from the
> revision. It could be part of the module name for instance.
>
> > And then I have such a configuration in the ivy.xml file:
> >
> > <dependencies>
> >
> >
> >  <dependency org="my-company" name="apps" rev="0.2.0-SNAPSHOT"/>
> >
> >
> > </dependencies>
>
> then your dependency would also look like:
> <dependency org="com.my-company" name="apps" rev="0.2.0-SNAPSHOT"/>
>
> Nicolas
>
>
> >
> > Because of the "hackyness" feeling I get from the ivy-settngs.xml.
> >
> > Am I missing something here ? Did I misunderstand the XML semantics of
> Ivy
> > and end up writing a rather bizarre configuration ?
> >
> > --
> > Romain PELISSE,
> > *"The trouble with having an open mind, of course, is that people will
> > insist on coming along and trying to put things in it" -- Terry
> Pratchett*
> > http://belaran.eu/wordpress/belaran
>
>


-- 
Romain PELISSE,
*"The trouble with having an open mind, of course, is that people will
insist on coming along and trying to put things in it" -- Terry Pratchett*
http://belaran.eu/wordpress/belaran

Re: Using Ivy to download zip files from a Maven repository (nexus)

Posted by Nicolas Lalevée <ni...@hibnet.org>.
Le 4 janv. 2011 à 18:24, Romain Pelisse a écrit :

> Hi Ivy users,
> 
> I used Ivy as part of my deployment tools. Our apps are packaged as zip
> files and Ivy fetches them from a maven repository. So I have an ivysettings
> .xml file where I declare our local repository:
> 
> <ivysettings>
> 
> 
>  <settings defaultResolver="my-company" />
> 
> 
>  <resolvers>
> 
> 
>    <chain name="my-company">
> 
> 
>      <url name="my-company">
> 
> 
>        <ivy pattern="http://
> my-company.repo/nexus/content/repositories/hosted-snapshot/com/my-company/[module]_2.8.0/[revision]/[artifact]-[revision].zip"
> />
>        <artifact pattern="http://
> my-company.repo/nexus/content/repositories/hosted-snapshot/com/my-company/[module]_2.8.0/[revision]/[artifact]-[revision].zip"
> />
>      </url>
> ...
> 
> (look like a hack  if you ask me - especially the hard coded url prefix
> 'com/my-company' and the hard coded file type, but it was the only I find to
> have this working)

You should set the m2compatible attribute to true, it will transform the dots into slashes:
http://ant.apache.org/ivy/history/latest-milestone/resolver/url.html
Then your pattern would look like:
http://my-company.repo/nexus/content/repositories/hosted-snapshot/[organisation]/[module]_2.8.0/[revision]/[artifact]-[revision].[ext]

I don't know what "2.8.0" stands for since it seems different from the revision. It could be part of the module name for instance.

> And then I have such a configuration in the ivy.xml file:
> 
> <dependencies>
> 
> 
>  <dependency org="my-company" name="apps" rev="0.2.0-SNAPSHOT"/>
> 
> 
> </dependencies>

then your dependency would also look like:
<dependency org="com.my-company" name="apps" rev="0.2.0-SNAPSHOT"/>

Nicolas


> 
> Because of the "hackyness" feeling I get from the ivy-settngs.xml.
> 
> Am I missing something here ? Did I misunderstand the XML semantics of Ivy
> and end up writing a rather bizarre configuration ?
> 
> -- 
> Romain PELISSE,
> *"The trouble with having an open mind, of course, is that people will
> insist on coming along and trying to put things in it" -- Terry Pratchett*
> http://belaran.eu/wordpress/belaran