Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ivy via Nexus proxy

Tags:

proxy

nexus

ivy

does anyone knows how do I specify in Ivy something like mirror/mirrorOf in Maven? I'm working with a local Maven proxy (Nexus) and need the tool to specify which of the parent repositories should Nexus proxy be accessing.

In Maven I do simply:

<mirrors>
  <mirror>
    <id>central-mirror</id>
    <mirrorOf>central</mirrorOf>
    <url>http://localhost:8081/content/repositories/central</url>
  </mirror>
</mirrors>

but I can't find this kind of option in Ivy.

like image 700
Matthias Hryniszak Avatar asked Jun 23 '09 16:06

Matthias Hryniszak


People also ask

What is Nexus proxy?

Smart Proxy is a Nexus Repository Manager feature that allows synchronization between multiple repositories. It can be set up by a Nexus Repository Manager administrator using the user interface. With Smart Proxy: Sonatype subscribes to events in the repositories you configure.

What are the types of Nexus repository?

Nexus Repository Manager provides for three different kinds of repositories: Proxy repositories, Hosted repositories and Virtual repositories.

How do I connect to Nexus repository?

To start with repository management, you will have to sign in. The default username is admin. You will find the default password in the path mentioned on the sign-in page. Nexus has a few repositories by default.

What is raw repository in Nexus?

A raw proxy repository can be used to proxy any static website. This includes a Maven site hosted in a raw repository in another Nexus Repository Manager server or a plain static website hosted on another web server like Apache httpd.


1 Answers

You need to create a public resolver that does what you want (more details @ Ivy docs)

Basically save the following snippet under $USERHOME/.ivy2/ivysettings-public.xml. This should do the trick.

<ivysettings> 
  <resolvers> 
    <ibiblio name="public" m2compatible="true" root="http://localhost:8081/content/groups/public"/> 
  </resolvers> 
</ivysettings>
  • The unmodified standard installation has 'nexus' in the URL!
  • If you need to deploy artifacts, I think the solution is to do something similar to the shared resolver (see link to docs above), but I haven't tried.
  • I changed your local URL to resolve to the standard 'content/groups/public' which is better since in the maven settings fragment above you're passing all calls through the mirror, not just the ones to central. Just add any additional repositories to that group in the Nexus UI as they come up and you should be fine.
  • If your project loads it's own ivysettings which doesn't honor the defaults, then these settings will not get loaded and you're again back at zero :(
like image 122
Heron Avatar answered Jan 03 '23 18:01

Heron