On 21/01/10 9:29 PM, tinca wrote:
Following the user guide here is my attempt to do the above, which does not
really work:

repositories {
     add(new org.apache.ivy.plugins.resolver.URLResolver()) {
         name = 'theRepo'
         addIvyPattern
"http://our.www.server/librepo/[module]/[revision]/[artifact].[ext]";
         addArtifactPattern
"http://our.www.server/librepo/[module]/[revision]/[artifact].[ext]";
         descriptor = 'lib repo'
         checkmodified = true
     }
}

dependencies {
     compile module("rio:rio:4.0-M2") {
         dependency ("rio:boot:4.0-M2")
         dependency ("rio:cybernode:4.0-M2")
         dependency ("rio:classdepandjar:4.0-M2")
         dependency ("groovy:org.groovy:1.6-RC-1")
         dependency ("commons-collections:commons-collections:")
}

The www server's dir structure:
<www_root>/
     rio/4.0-M2/
          rio.jar
          ...
     groovy/1.6-RC-1/groovy-all-1.6-RC-1.jar
....

Executing the build script results in a gradle's cache that contains
only rio/rio/rio-4.0-M2.jar (and some descriptor files), so the other jars
are not downloaded and the only one is renamed.


One problem you have is that the compile configuration does not include transitive dependencies, so Gradle is only going to look for rio:rio:4.0-M2 and nothing else. It will ignore the transitive dependencies you have declared for it inside the module() { } closure.

Some options you have:

- If your code only needs rio:rio to compile, then move the module definition to the runtime configuration:

dependencies {
    compile 'rio:rio:4.0-M2'
    runtime module('rio:rio:4.0-M2') { dependency .... }
}

- If your code needs the other jars to compile, get rid of the module() definition and list the jars separately. Alternatively, you could just change the compile configuration to include transitive dependencies:

configurations.compile.transitive = true


URLResolver (and its supers) has little or nothing javadoc to explain
addIvyPattern and addArtifactPattern so I am still looking for info what
strings to pass to them.


I would say if you're getting the rio jar, then you've configured the resolver ok. I think instead you're running into the problem above.

In the Gradle 0.10 release, we plan on replacing the Ivy classes with our own repository API and DSL, which will be better documented and simpler to use.

Also, at some point, we will revisit whether the compile configuration should be transitive or not, and also rework the module() concept to work more easily with these built-in configurations.


--
Adam Murdoch
Gradle Developer
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to