//START SNIPPET maven-central
repositories {
    mavenCentral()
}
//END SNIPPET maven-central

//START SNIPPET maven-password-protected-repo
org.apache.ivy.util.url.CredentialsStore.INSTANCE.addCredentials("REALM", "HOST", "USER", "PASSWORD"); 
//END SNIPPET maven-password-protected-repo

//START SNIPPET maven-central-jar-repo
repositories {
    mavenCentral name: 'single-jar-repo', urls: "http://repo.mycompany.com/jars"
    mavenCentral name: 'multi-jar-repos', urls: ["http://repo.mycompany.com/jars1", "http://repo.mycompany.com/jars2"]
}
//END SNIPPET maven-central-jar-repo

//START SNIPPET maven-local
repositories {
    mavenLocal()
}
//END SNIPPET maven-local

//START SNIPPET maven-like-repo
repositories {
    mavenRepo urls: "http://repo.mycompany.com/maven2"
}
//END SNIPPET maven-like-repo

//START SNIPPET maven-like-repo-with-jar-repo
repositories {
    mavenRepo urls: ["http://repo2.mycompany.com/maven2", "http://repo.mycompany.com/jars"]
}
//END SNIPPET maven-like-repo-with-jar-repo

//START SNIPPET flat-dir
//START SNIPPET flat-dir-multi
repositories {
    flatDir name: 'localRepository', dirs: 'lib'
//END SNIPPET flat-dir
    flatDir dirs: ['lib1', 'lib2']
//START SNIPPET flat-dir
}
//END SNIPPET flat-dir
//END SNIPPET flat-dir-multi


task lookup << {
    //START SNIPPET lookup-resolver
    println repositories.localRepository.name
    println repositories['localRepository'].name
    //END SNIPPET lookup-resolver
}

//START SNIPPET configure-resolver
repositories {
    localRepository {
        addArtifactPattern(file('lib').absolutePath + '/[name]/[revision]/[name]-[revision].[ext]')
    }
}
repositories.localRepository {
    addArtifactPattern(file('lib').absolutePath + '/[name]/[revision]/[name]-[revision].[ext]')
}
//END SNIPPET configure-resolver
