Hello Jean, 

You might want to check out the tutorial example here
https://ant.apache.org/ivy/history/master/tutorial/multiple.html

To use multiple resolvers I think you will want use the chain resolver type 
https://ant.apache.org/ivy/history/2.1.0/resolver/chain.html
which will contain your 2 url resolvers.

Also set your default resolver to that of the chain

<settings defaultResolver="all-repos"/>

  <resolvers>
         <chain name="all-repos">
                <url name="Sosy-Lab" descriptor="required">
                        <ivy 
pattern="${ivy.repo.url}/[organisation]/[module]/ivy-[revision].xml"/>
                               <artifact 
pattern="${ivy.repo.url}/[organisation]/[module]/[artifact]-[revision](-[classifier]).[ext]"/>
                        </url>
                  <url name="maven.release">
                         <ivy 
pattern="${public.repositories}/${maven.ivy.pattern.default}" />
                         <artifact 
pattern="${public.repositories}/${maven.artifact.pattern.default}" />
                  </url>
         </chain>
  </resolvers>

Good luck,
Chris


-----Original Message-----
From: Jean Faure <jeannffa...@gmail.com> 
Sent: Wednesday, 30 November 2022 8:43 PM
To: ivy-user@ant.apache.org
Subject: How to configure these two repositories at once

Hi, I would like to use the default maven repository with Ivy. I have found the 
following settings for this:

    <ivysettings>
        <chain name="default-chain">
          <ibiblio name="maven.org" m2compatible="true"/>
        </chain>
    </ivysettings>

I would also like to use another repository which says that it requires the 
following settings:

    <ivysettings>
            <property name="ivy.repo.url" value="http://www.sosy-lab.org/ivy
"/>
            <settings defaultResolver="Sosy-Lab"/>
            <resolvers>
                    <url name="Sosy-Lab" descriptor="required">
                    <ivy
pattern="${ivy.repo.url}/[organisation]/[module]/ivy-[revision].xml"/>
                    <artifact
pattern="${ivy.repo.url}/[organisation]/[module]/[artifact]-[revision](-[classifier]).[ext]"/>
                    </url>
            </resolvers>
    </ivysettings>

Thus, the following `ivy.xml` would work:

    <ivy-module version="2.0">
        <info organisation="org.apache" module="hello-ivy"/>
        <dependencies>
            <dependency org="org.sosy_lab" name="java-smt" rev="3.7.0"/>
            <dependency org="org.springframework" name="spring-core"
rev="3.0.6.RELEASE" >
                <artifact name="spring-core" type="jar" />
            </dependency>
        </dependencies>
    </ivy-module>

However, the definitions for each of the repository look kind-of different and 
so I do not know how to merge them into a single settings file. As of now, the 
settings for maven above do not even work for `spring-core` in the example 
`ivy.xml`.

This does not seem to work:

<ivysettings>
    <property name="sosy-lab.repo.url" value="http://www.sosy-lab.org/ivy"/>
    <property name="maven.repo.url" value="http://maven.org/"/>
    <!--settings defaultResolver="Sosy-Lab"/-->
    <resolvers>
        <url name="Sosy-Lab" descriptor="required">
            <ivy
pattern="${sosy-lab.repo.url}/[organisation]/[module]/ivy-[revision].xml"/>
            <artifact
pattern="${sosy-lab.repo.url}/[organisation]/[module]/[artifact]-[revision](-[classifier]).[ext]"/>
        </url>
        <url name="maven.org" descriptor="required">
            <ivy
pattern="${maven.repo.url}/[organisation]/[module]/ivy-[revision].xml"/>
            <artifact
pattern="${maven.repo.url}/[organisation]/[module]/[artifact]-[revision](-[classifier]).[ext]"/>
        </url>
    </resolvers>
</ivysettings>

How to configure Ivy so that it looks up both repositories?

Reply via email to