This leads to a question I've been wondering about: Is it possible or 
reasonable to make the credentials closure lazy evaluated.  Right now, it 
executes the closure whether or not it's necessary to download artifacts.

I can imagine a scenario where you had a maven definition:

maven {
  url 'foo.bar.com'
  credentials {
    username doSomeFancyLookup()
    password doAnotherFancyLookup()
  }
}

where the username and password properties could follow a resolution order.  If 
the properties were set in gradle.properties or init.gradle, use those.  If a 
console is available, use readPassword.  If the jvm isn't headless, use Swing.  
or any other credential looking you might think of.

This approach only makes sense if the properties are lazy-loaded though, 
otherwise they get executed on every build.


--b


On Dec 2, 2011, at 2:43 PM, Daz DeBoer wrote:

> The first form (maven{}) is more idiomatic. The primary difference between 
> maven{} and mavenRepo() is that the latter returns the underlying ivy 
> DependencyResolver instance, which can be manipulated directly. Once we are 
> happy that maven{} supports all of the reasonable use cases for dependency 
> resolution, mavenRepo will likely be deprecated.
> 
> The reason for this change is that we are moving away from exposing ivy as 
> part of our API. The motivation is that we want to be able to provide a 
> richer, more domain-specific api for dependency resolution, and not be tied 
> to the ivy API or implementation.
> 
> One benefit to the maven{} syntax is that it provides the ability to 
> lazy-evaluate the url (and other) parameters, whereas the url parameter of 
> mavenRepo must be know at the time of declaring the repository.
> 
> cheers
> Daz
> 
> On 2 December 2011 11:24, Russel Winder <rus...@russel.org.uk> wrote:
> Quick question as to whether one form is more idiomatic than the other:
> 
>        repositories {
>                mavenCentral ( )
>                maven { url 'http://repository.codehaus.org/' }
>        }
> 
> or
> 
>        repositories {
>                mavenCentral ( )
>                mavenRepo url : 'http://repository.codehaus.org/'
>        }
> 
> Thanks.
> 
> --
> Russel.
> =============================================================================
> Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
> 41 Buckmaster Road    m: +44 7770 465 077   xmpp: rus...@russel.org.uk
> London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
> 
> 
> 
> -- 
> Darrell (Daz) DeBoer
> Principal Engineer, Gradleware 
> http://www.gradleware.com
> 


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

    http://xircles.codehaus.org/manage_email


Reply via email to