Hi all,

So I'm interested in using some of the code from this Riot project:
http://www.riotfamily.org/index.html . They have a project skeleton that
uses their Ivy repo (http://www.riotfamily.org/ivy/repo/) to start up and
build their project.

I thought it would be fairly simple to convert that build to Gradle, adding
a few maven dependencies from my company's central mirror, but it's proving
a little difficult...

First, I ran into the problem that gradle was trying to retrieve
dependencies in the 'default' configuration (I think because that's what Ivy
maps maven's main artifact to), so I used a trick found on this list to
reduce the dependencyMappingConfiguration to 'runtime' which is the
dependency used in the riot repo for their own jars.

    dependencies.each { dependency ->
        dependency.dependencyConfigurationMappings.mappings.clear()
        dependency.dependencyConfigurations('runtime')
    }

Here's the relevant part of the build.gradle (I started with trying only to
resolve a single riot dependency):

dependencies {

    addMavenStyleRepo('AcmeRepo',"http://www.acme.com/repo";)
    classpathResolvers.add(new WebdavResolver()) {
        name = 'RiotRepo'
        addIvyPattern("
http://www.riotfamily.org/ivy/repo/[organisation]/[module]/[revision]/ivy.xml
")
        addArtifactPattern("
http://www.riotfamily.org/ivy/repo/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]
")
        addArtifactPattern("
http://www.riotfamily.org/ivy/repo/[organisation]/[module]/[artifact]-[revision].[ext]
")
    }

    compile    "riotfamily:riot-common:8.0"

    dependencies.each { dependency ->
        dependency.dependencyConfigurationMappings.mappings.clear()
        dependency.dependencyConfigurations('runtime')
    }

}

fails with the following unresolve dependency:

 cglib#cglib;2.1_3: configuration not found in cglib#cglib;2.1_3: 'nodep'.
It was required from springframework#spring;2.5.6 aop

The reason is that they seem to have used some done some cutesy dependency /
configuration stuff for their non-company artifacts:
http://www.riotfamily.org/ivy/repo/springframework/spring/2.5.6/ivy.xml .
These dependencies are reached transitively from the base riot "runtime"
dependencies.

So aop, webmvc, mail etc are different configurations of the spring 2.5.6
artifact rather than different artifacts. While ivy's configuration
mechanism is certainly powerful enough to describe these different jars, I
dunno if this is really good practice or not because it lead do this:

spring (aop config) depends on cglib (nodep config) (you have have to view
source on the above ivy.xml link to see through their stylesheet). Oh crap,
my gradle cache already has a cglib2.1_3 entry that was downloaded from the
AcmeRepo (our maven mirror), and it has only a default configuration.

So I'm left with deleting that entry to get this riot build to pass, which
will then cause whichever other build that downloaded the cglib dependency
to fail. It seems that if it's ok for organizations like riot to draw up
their own ivy.xml dependency maps, then ivy / gradle should not cache the
resolved jars/deps in the same places. Or is riot in the wrong? cglib builds
itself with maven, why should riot be entitled to publish dependency
information in a public repo that is not standard? But isn't the point of
Ivy that it lets you manage and define your own repositories with your own
unique snowflake layout? There is no "central ivy repo" after all...

Any comments or suggestions?

Thanks
Neil

Reply via email to