0

It seems that Apache ivy downloads artifacts only from http://mvnrepository.com/ and few other places, but all the jars are outdated there.

So I am trying to add custom repository for Ivy. I am using repository Ivy RoundUp : http://code.google.com/p/ivyroundup/

This is my configuration, but getting error:

build.xml:

<target name="update" depends="init-ivy" description="Download project dependencies">
    <!-- edited for brevity -->
    <ivy:settings file="ivysettings.xml" />
    <ivy:retrieve pattern="war/WEB-INF/lib/[artifact]-[revision].[ext]" />
    <!-- edited for brevity -->
</target>

ivy.xml :

<ivy-module version="2.0">
    <info organisation="org.apache" module="hello-ivy"/>
    <dependencies>
        <dependency org="org.springframework" name="spring" rev="3.0.6" conf="default->master"/>

    </dependencies>
</ivy-module>

ivysettings.xml:

<ivysettings>
    <resolvers>
        <packager name="roundup" buildRoot="${user.home}/.ivy2/packager/build" resourceCache="${user.home}/.ivy2/packager/cache">
            <ivy pattern="http://ivyroundup.googlecode.com/svn/trunk/repo/modules/[organisation]/[module]/[revision]/ivy.xml"/>
            <artifact pattern="http://ivyroundup.googlecode.com/svn/trunk/repo/modules/[organisation]/[module]/[revision]/packager.xml"/>
        </packager>
    </resolvers>
</ivysettings>

error:

Buildfile: C:\Users\Jansu\workspace\HibernateSpring\build.xml
build:
deploywar:
      [war] Building war: C:\Users\Jansu\workspace\HibernateSpring\hibernate.war
     [copy] Copying 1 file to C:\apache-tomcat-7.0.20\webapps
download-ivy:
      [get] Getting: http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.2.0/ivy-2.2.0.jar
      [get] To: C:\Users\Jansu\.ant\lib\ivy-2.2.0.jar
      [get] Not modified - so not downloaded
init-ivy:
update:
[ivy:retrieve] :: Ivy 2.2.0 - 20100923230623 :: http://ant.apache.org/ivy/ ::
[ivy:retrieve] :: loading settings :: file = C:\Users\Jansu\workspace\HibernateSpring\ivysettings.xml
[ivy:retrieve] :: resolving dependencies :: org.apache#hello-ivy;working@Jansu-PC
[ivy:retrieve]  confs: [default]
[ivy:retrieve] :: resolution report :: resolve 110ms :: artifacts dl 0ms
    ---------------------------------------------------------------------
    |                  |            modules            ||   artifacts   |
    |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
    ---------------------------------------------------------------------
    |      default     |   1   |   0   |   0   |   0   ||   0   |   0   |
    ---------------------------------------------------------------------
[ivy:retrieve] :: problems summary ::
[ivy:retrieve] :::: WARNINGS
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      ::          UNRESOLVED DEPENDENCIES         ::
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]      :: org.springframework#spring;3.0.6: no resolver found for org.springframework#spring: check your configuration
[ivy:retrieve]      ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] 
[ivy:retrieve] :::: ERRORS
[ivy:retrieve]  unknown resolver null
[ivy:retrieve]  no resolver found for org.springframework#spring: check your configuration
[ivy:retrieve] 
[ivy:retrieve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS

BUILD FAILED
C:\Users\Jansu\workspace\HibernateSpring\build.xml:177: impossible to resolve dependencies:
    resolve failed - see output for details

Total time: 2 seconds

So it seems that it does not find my resolver . I did configure the resolver like the custom repository asked me to: http://code.google.com/p/ivyroundup/wiki/HowToConfigureIvy

And here is list of all artifacts in that repo, so you can see that Spring 3.0.6 exists in there : http://ivyroundup.googlecode.com/svn/trunk/repo/modules.xml

Any suggestions? Feel free to ask more information.

EDIT:

build.properties :

ivy.install.version=2.2.0
ivy.home=${user.home}/.ant
ivy.jar.dir=${ivy.home}/lib
ivy.jar.file=${ivy.jar.dir}/ivy-${ivy.install.version}.jar
Jaanus
  • 16,161
  • 49
  • 147
  • 202

4 Answers4

11

Ivyroundup is designed around the packager resolver in ivy. This resolver is incredibly clever, demonstrates the true power of ivy, but the bulk of the world uses Maven repositories to host their software. Fact is soon Maven Central will contain nearly 90% of the world's Java open source components.

Enabling Maven repositories

Thankfully, ivy fully understands Maven repositories, meaning we can use ivy as a client and let very good products like Nexus host the repository. Here's the settings file that enables Maven Central:

<ivysettings>
  <settings defaultResolver='central'/>
  <resolvers>
    <ibiblio name='central' m2compatible='true'/>
  </resolvers>
</ivysettings>

I would highly recommend you consider setting up you own local instance of Nexus (Or Artifactory, or Archiva...). You can then cache Maven central artifacts (more efficient), search for software components and upload and host artifacts which cannot be downloaded, due to license restrictions (JDBC jars).

Enabling a local repository manager also uses the ibiblio resolver as follows:

<ivysettings>
  <settings defaultResolver='nexus'/>
  <resolvers>
    <ibiblio name='nexus' m2compatible='true' root='https://nexus.mydomain.com:8081/nexus/content/groups/central/' />
  </resolvers>
</ivysettings>

Searching Maven Central (New ivy support features)

You're looking for the Spring 3.0.6 release? It's already in Maven Central:

http://search.maven.org/#search|ga|1|g%3A%22org.springframework%22%20AND%20v%3A%223.0.6.RELEASE%22

The Spring core artifact details are here:

http://search.maven.org/#artifactdetails|org.springframework|spring-core|3.0.6.RELEASE|jar

The search page now conveniently gives you both the Maven and ivy client declaration to copy into your build:

<dependency org="org.springframework" name="spring-core" rev="3.0.6.RELEASE" >
    <artifact name="spring-core" type="jar" />
</dependency>
Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
  • Wow thanks, this helped, I was hoping that you would answer Mark :) Now this does not use the ivyroundup, but uses the maven central library right? It is fine, as long as there are the newest libraries :) – Jaanus Sep 09 '11 at 14:14
  • Yes my example uses maven central. No disrepect to the ivyroundup project but they're always going to play catch up. Springsource have their own maven repo but they've now releasing to maven central – Mark O'Connor Sep 09 '11 at 18:53
  • Oh yeah, actually it doesn't matter if I use ivyroundup or any other repo as long as I get my artifacts lol. thanks – Jaanus Sep 10 '11 at 05:27
1

for sake of completeness ...

ivysettings.xml with a chain resolver for

  1. https://maven.org
  2. https://jitpack.io/
<ivysettings>
  <settings defaultResolver="default-chain"/>
  <resolvers>
    <chain name="default-chain">
      <!-- default resolver
        <ibiblio name="maven.org" m2compatible="true" root="https://repo1.maven.org/maven2"/>
      -->
      <ibiblio name="maven.org" m2compatible="true"/>
      <!-- resolver for github
        example use in ivy.xml: https://github.com/omajid/xdg-java
        <dependency org="com.github.omajid" name="xdg-java" rev="7c623b86e6b99bef0a72db86318663ad3c0270e5" conf="compile->master"/>
      -->
      <ibiblio name="jitpack.io" m2compatible="true" root="https://jitpack.io/"/>
    </chain>
  </resolvers>
</ivysettings>
milahu
  • 2,447
  • 1
  • 18
  • 25
0

you must have something to tell whats the default resolver, like, <conf defaultResolver="default" />

Jackie
  • 25,199
  • 6
  • 33
  • 24
0

Your update target should invoke ivy:resolve task after ivy:settings.

<target name="update" depends="init-ivy" description="Download project dependencies">
  <ivy:settings file="ivysettings.xml" />
  <ivy:resolve conf="default" />
  <ivy:retrieve pattern="war/WEB-INF/lib/[artifact]-[revision].[ext]" />
</target>
Alexey Kiselev
  • 916
  • 7
  • 8
  • Still same error, maybe the problem is because my ivy cache and library are downloaded to {user.home}/.ant .. or somethin like that .. I added ivy build.properties to question. – Jaanus Sep 06 '11 at 10:06