On 3/03/10 10:20 PM, Hans Dockter wrote:

On Tue, Mar 2, 2010 at 6:53 PM, Peter Ledbrook <[email protected] <mailto:[email protected]>> wrote:

    Hi,

    Graeme recently added an Ivy resolver to Grails that can pick up
    plugins from the Grails Central Plugin Repository. I'd like to make
    this resolver (and maybe others) available to the project so that the
    user can do something like:

    repositories {
      ...
      grailsCentral()
    }
    ...
    dependencies {
       compile "org.grails.plugins:grails-shiro:1.1"
    }

    In fact, it would be nice to add:

     repositories {
         grailsHome()
     }

    where 'grailsHome' would be a simple flat dir resolver.

    Is this currently possible?


Almost. I'm about to commit a small change to make the DefaultRepositoryHandler a dynamc object.

With that change you can do something like this:

// grails is an arbitrary identifier for the convention object
repositories.convention.plugins.grails = new GrailsConvention(repositories)

class GrailsConvention {
    def repositories

    def GrailsConvention(def repositories) {
        this.repositories = repositories
    }

    def grailsHome() {
        repositories.add ...
    }
    def grailsCentral() {
        repositories.add ...
    }
}

After that you can do:

repositories.grailsHome()

Unfortunately you can't do:

repositories {
   grailsHome()
}

We don't know why yet. This has something to do with Groovy.

cl = {
   grailsHome()
}
cl.delegate = repositories
cl.call()

This does also not work, whereas, as said above, repositories.grailsHome() works.

There is a Jira for this: http://jira.codehaus.org/browse/GRADLE-837


This is fixed now.


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

Reply via email to