Advanced repository - step 2


Building the professional repository

Now that we have been well prepared, let's go to a real life example of building our repository.
We will now focus on a bigger example that uses different public repositories to retrieve the information.
In this tutorial we will use, in order of preference :
  • our home made repository
  • ivyrep official
  • ibiblio maven2

the resolvers used

<resolvers>
<filesystem name="local-repository">
<ivy pattern="${dest.repo.dir}/[organisation]/[module]/ivys/ivy-[revision].xml"/>
<artifact pattern="${dest.repo.dir}/[organisation]/[module]/[type]s/[artifact]-[revision].[type]"/>
</filesystem>

<chain name="libraries" returnFirst="false">
<resolver ref="local-repository" />
<ivyrep name="official-ivy-rep"/>
<resolver ref="ibiblio-maven2" />
</chain>
</resolvers>
We start the chain with our home made repository because as we can expect, we consider this repository as good ivy file repository (that's why we create it). So all files that are in this repository are considered as valid and correct and usuable.
The building process is then an iterative process.
After each import of new projects into our repository, we check and modify the generated ivy files (or you do not as you want). The generated ivy files are those that were translated from a POM or those for which an artifact has been found without a module descriptor (ivy or pom).

Let's go

What about to test our settings with a big project : hibernate 3.0
Just run : ant advanced

Here we go !!!!!!!!
Z:\build-a-ivy-repository>ant advanced
Buildfile: build.xml

init-advanced:
:: Ivy non official version :: http://ivy.jayasoft.org/ ::
:: configuring :: file = Z:\build-a-ivy-repository\config\ivy-conf-advanced.xml

advanced:
:: installing [ hibernate | hibernate | 3.0 ] ::
:: resolving dependencies ::
found [ hibernate | hibernate | 3.0 ] in ibiblio-maven2
found [ apache | commons-logging | 1.0.4 ] in official-ivy-rep
found [ apache | ant | 1.6.3 ] in ibiblio-maven2
found [ c3p0 | c3p0 | 0.8.4.5 ] in official-ivy-rep
found [ proxool | proxool | 0.8.3 ] in official-ivy-rep
found [ ehcache | ehcache | 1.1 ] in official-ivy-rep
found [ apache | xerces | 2.5.0 ] in official-ivy-rep
found [ apache | commons-collections | 2.1.1 ] in official-ivy-rep
found [ opensymphony | oscache | 2.1 ] in ibiblio-maven2
found [ swarmcache | swarmcache | 1.0RC2 ] in official-ivy-rep
found [ apache | commons-collections | 2.1 ] in official-ivy-rep
found [ apache | commons-logging | 1.0.2 ] in official-ivy-rep
found [ jgroups | jgroups | 2.2 ] in official-ivy-rep
found [ jboss | jboss-cache | 1.2.2 ] in ibiblio-maven2
found [ jboss | jboss-system | 4.0.2 ] in ibiblio-maven2
found [ jboss | jboss-common | 4.0.2 ] in ibiblio-maven2
found [ jboss | jboss-minimal | 4.0.2 ] in ibiblio-maven2
found [ jboss | jboss-j2se | 200504122039 ] in ibiblio-maven2
found [ concurrent | concurrent | 1.3.4 ] in ibiblio-maven2
found [ jgroups | jgroups-all | 2.2.7 ] in ibiblio-maven2
found [ cglib | cglib | 2.0.2 ] in official-ivy-rep
found [ objectweb | asm | 1.3.4 ] in official-ivy-rep
found [ asm | asm | 1.4.3 ] in ibiblio-maven2
found [ javax.security | jacc | 1.0 ] in ibiblio-maven2
found [ dom4j | dom4j | 1.6 ] in ibiblio-maven2
found [ javax.transaction | jta | 1.0.1B ] in ibiblio-maven2
found [ hibernate | antlr | 2.7.5H3 ] in ibiblio-maven2
found [ odmg | odmg | 3.0 ] in official-ivy-rep
:: downloading artifacts to cache ::
downloading http://www.ibiblio.org/maven2/hibernate/hibernate/3.0/hibernate-3.0.jar ...
..................................................
.. (1565kB)
[SUCCESSFUL ] [ hibernate | hibernate | 3.0 ]/hibernate.jar[jar] (8500ms)
downloading http://www.ibiblio.org/maven2/hibernate/antlr/2.7.5H3/antlr-2.7.5H3.jar ...

SOME MINUTES LATER !!!!!!!!!!

downloading http://www.ibiblio.org/maven/commons-logging/jars/commons-logging-1.0.4.jar ...
........ (37kB)
[SUCCESSFUL ] [ apache | commons-logging | 1.0.4 ]/commons-logging.jar[jar] (1110ms)
:: installing in local-repository ::
published hibernate to Z:\build-a-ivy-repository/ivy-local-repository/hibernate/hibernate/jars/hibernate-3.0.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/hibernate/hibernate/ivys/ivy-3.0.xml
published antlr to Z:\build-a-ivy-repository/ivy-local-repository/hibernate/antlr/jars/antlr-2.7.5H3.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/hibernate/antlr/ivys/ivy-2.7.5H3.xml
published dom4j to Z:\build-a-ivy-repository/ivy-local-repository/dom4j/dom4j/jars/dom4j-1.6.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/dom4j/dom4j/ivys/ivy-1.6.xml
missing artifact [ javax.security | jacc | 1.0 ]/jacc.jar[jar]: Z:\build-a-ivy-repository\cache\javax.security\jacc\jars\jacc-1.0.jar file does not exist
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/javax.security/jacc/ivys/ivy-1.0.xml
published asm to Z:\build-a-ivy-repository/ivy-local-repository/asm/asm/jars/asm-1.4.3.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/asm/asm/ivys/ivy-1.4.3.xml
published cglib-full to Z:\build-a-ivy-repository/ivy-local-repository/cglib/cglib/jars/cglib-full-2.0.2.jar
published cglib to Z:\build-a-ivy-repository/ivy-local-repository/cglib/cglib/jars/cglib-2.0.2.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/cglib/cglib/ivys/ivy-2.0.2.xml
published asm to Z:\build-a-ivy-repository/ivy-local-repository/objectweb/asm/jars/asm-1.3.4.jar
published asm-util to Z:\build-a-ivy-repository/ivy-local-repository/objectweb/asm/jars/asm-util-1.3.4.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/objectweb/asm/ivys/ivy-1.3.4.xml
published jboss-cache to Z:\build-a-ivy-repository/ivy-local-repository/jboss/jboss-cache/jars/jboss-cache-1.2.2.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/jboss/jboss-cache/ivys/ivy-1.2.2.xml
published jgroups-all to Z:\build-a-ivy-repository/ivy-local-repository/jgroups/jgroups-all/jars/jgroups-all-2.2.7.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/jgroups/jgroups-all/ivys/ivy-2.2.7.xml
published concurrent to Z:\build-a-ivy-repository/ivy-local-repository/concurrent/concurrent/jars/concurrent-1.3.4.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/concurrent/concurrent/ivys/ivy-1.3.4.xml
published jboss-j2se to Z:\build-a-ivy-repository/ivy-local-repository/jboss/jboss-j2se/jars/jboss-j2se-200504122039.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/jboss/jboss-j2se/ivys/ivy-200504122039.xml
published jboss-minimal to Z:\build-a-ivy-repository/ivy-local-repository/jboss/jboss-minimal/jars/jboss-minimal-4.0.2.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/jboss/jboss-minimal/ivys/ivy-4.0.2.xml
published jboss-system to Z:\build-a-ivy-repository/ivy-local-repository/jboss/jboss-system/jars/jboss-system-4.0.2.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/jboss/jboss-system/ivys/ivy-4.0.2.xml
published swarmcache to Z:\build-a-ivy-repository/ivy-local-repository/swarmcache/swarmcache/jars/swarmcache-1.0RC2.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/swarmcache/swarmcache/ivys/ivy-1.0RC2.xml
missing artifact [ jgroups | jgroups | 2.2 ]/jgroups.jar[jar]: Z:\build-a-ivy-repository\cache\jgroups\jgroups\jars\jgroups-2.2.jar file does not exist
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/jgroups/jgroups/ivys/ivy-2.2.xml
published commons-logging to Z:\build-a-ivy-repository/ivy-local-repository/apache/commons-logging/jars/commons-logging-1.0.2.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/apache/commons-logging/ivys/ivy-1.0.2.xml
published oscache to Z:\build-a-ivy-repository/ivy-local-repository/opensymphony/oscache/jars/oscache-2.1.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/opensymphony/oscache/ivys/ivy-2.1.xml
published c3p0 to Z:\build-a-ivy-repository/ivy-local-repository/c3p0/c3p0/jars/c3p0-0.8.4.5.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/c3p0/c3p0/ivys/ivy-0.8.4.5.xml
published odmg to Z:\build-a-ivy-repository/ivy-local-repository/odmg/odmg/jars/odmg-3.0.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/odmg/odmg/ivys/ivy-3.0.xml
published proxool to Z:\build-a-ivy-repository/ivy-local-repository/proxool/proxool/jars/proxool-0.8.3.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/proxool/proxool/ivys/ivy-0.8.3.xml
missing artifact [ javax.transaction | jta | 1.0.1B ]/jta.jar[jar]: Z:\build-a-ivy-repository\cache\javax.transaction\jta\jars\jta-1.0.1B.jar file does not exist
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/javax.transaction/jta/ivys/ivy-1.0.1B.xml
published jboss-common to Z:\build-a-ivy-repository/ivy-local-repository/jboss/jboss-common/jars/jboss-common-4.0.2.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/jboss/jboss-common/ivys/ivy-4.0.2.xml
published ant to Z:\build-a-ivy-repository/ivy-local-repository/apache/ant/jars/ant-1.6.3.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/apache/ant/ivys/ivy-1.6.3.xml
published commons-collections to Z:\build-a-ivy-repository/ivy-local-repository/apache/commons-collections/jars/commons-collections-2.1.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/apache/commons-collections/ivys/ivy-2.1.xml
published ehcache to Z:\build-a-ivy-repository/ivy-local-repository/ehcache/ehcache/jars/ehcache-1.1.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/ehcache/ehcache/ivys/ivy-1.1.xml
published commons-collections to Z:\build-a-ivy-repository/ivy-local-repository/apache/commons-collections/jars/commons-collections-2.1.1.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/apache/commons-collections/ivys/ivy-2.1.1.xml
published xercesImpl to Z:\build-a-ivy-repository/ivy-local-repository/apache/xerces/jars/xercesImpl-2.5.0.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/apache/xerces/ivys/ivy-2.5.0.xml
published commons-logging to Z:\build-a-ivy-repository/ivy-local-repository/apache/commons-logging/jars/commons-logging-1.0.4.jar
published ivy to Z:\build-a-ivy-repository/ivy-local-repository/apache/commons-logging/ivys/ivy-1.0.4.xml
:: install resolution report ::
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 28 | 28 | 28 | 0 || 30 | 27 |
---------------------------------------------------------------------

BUILD SUCCESSFUL
Total time: 2 minutes 10 seconds
Z:\build-a-ivy-repository>

Analyzing the results

OK, it seems that we have a good start point for our repository.
As you can see in the resolving part of the process :
:: resolving dependencies ::
found [ hibernate | hibernate | 3.0 ] in ibiblio-maven2
found [ apache | commons-logging | 1.0.4 ] in official-ivy-rep
...
found [ odmg | odmg | 3.0 ] in official-ivy-rep
some ivy files were retrieved from the ivyrep the official ivy repository. That means that for these modules, you have in your home made repository good ivy files (with meaningful configurations, ...).

And now

Now what you need to do is to download missing artifacts, those not on ibiblio (from sun, ...) and correct the generated ivy files.
It is important to make a review of the generated ivy files because you could then benefit from all the power of ivy by defining for those projects good configurations and some other good things.

To ease finding generated files, just take a look at the generated resolve report in your cache. You will find there the projects for which a default ivy file was generated
and you can see the resolvers that have resolved the modules. In our example, you will update the files whose project were resolved by the ibiblio-maven2 resolver.

Printer Friendly