You might be able to move the method definition into the buildscript section. For a discussion of the general problem, see: http://gradle.1045684.n5.nabble.com/Accessing-a-closure-from-within-the-buildscript-configuration-td3341695.html
-- Peter Niederwieser Principal Engineer, Gradleware http://gradleware.com Creator, Spock Framework http://spockframework.org Please vote Gradle for JAX Awards: http://vote.jax-awards.com Benjamin Muschko wrote: > > Hi, > > I am trying to define a repository in my build script simliar to the > mavenCentral() syntax. To make this work I created a method that returns > an instance of URLResolver. > > def gitHub() { > def resolver = new URLResolver() > > resolver.with { > name = 'GitHub' > addArtifactPattern > 'http://cloud.github.com/downloads/[organisation]/[module]/[module]-[revision].[ext]' > } > > resolver > } > > This works all fine when adding it to the repositories closure: > > repositories { > add gitHub() > } > > However, when trying to add it within the buildscript closure the method > cannot be found: > > buildscript { > repositories { > add gitHub() > } > } > > Caused by: org.gradle.api.internal.MissingMethodException: Could not find > method gitHub() for arguments [] on resolver container. > > My guess is that the method isn't available during initialization phase > but I might be wrong. Can somebody shed some light on this? Is there a > different way of making this work? > > Thanks, > > Ben > -- View this message in context: http://gradle.1045684.n5.nabble.com/Define-repository-similar-to-mavenCentral-within-build-script-tp4503651p4503740.html Sent from the gradle-user mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
