One way is via a shared variable:

buildscript {
  repoConfig = { ... }
  repositories repoConfig
}

repositories repoConfig

Another way is via a shared script:

buildscript {
  apply from: "repo.gradle", to: buildscript
}

apply from: "repo.gradle"

--
repo.gradle:
repositories { ... }

--
Peter Niederwieser
Principal Engineer, Gradleware 
http://gradleware.com
Creator, Spock Framework 
http://spockframework.org
Twitter: @pniederw




Etienne Studer wrote:
> 
> Hi
> 
> How can I avoid this duplication (same repo used for buildscript element
> and for repositories element):
> 
> buildscript {
>    repositories {
>       
> org.apache.ivy.util.url.CredentialsStore.INSTANCE.addCredentials(DOWNLOAD_REPO_REALM,
> DOWNLOAD_REPO_HOST, DOWNLOAD_REPO_USERNAME, DOWNLOAD_REPO_PASSWORD);
>        mavenRepo urls: DOWNLOAD_REPO_URL
>    }
> 
>    dependencies {
>        ….
>    }
> }
> 
> ...
> 
> repositories {
>   
> org.apache.ivy.util.url.CredentialsStore.INSTANCE.addCredentials(DOWNLOAD_REPO_REALM,
> DOWNLOAD_REPO_HOST, DOWNLOAD_REPO_USERNAME, DOWNLOAD_REPO_PASSWORD);
>    mavenRepo urls: DOWNLOAD_REPO_URL
> }
> 
> Any help is appreciated.
> 
> Regards, Etienne
> 


--
View this message in context: 
http://gradle.1045684.n5.nabble.com/how-to-reuse-repository-definition-tp4742950p4744094.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


Reply via email to