Do gradle configurations merge or override? -


say define plugin, so:

import org.gradle.api.artifacts.dsl.repositoryhandler import org.gradle.api.artifacts.repositories.mavenartifactrepository import org.gradle.api.project import org.gradle.api.plugin  class myrepos implements plugin<project> {     static final string nexus_url = 'http://nexus.mine.com/nexus/content/repositories/'     static final list<string> nexus_repos = [         'central',         'build',         'snapshots',         'release-candidates',         'releases',     ]      void apply(project project) {         project.repositories {             nexus_repos.each {                 maven {                     url (nexus_url + it)                 }             }             mavenlocal()         }         project.buildscript {             repositories {                 maven {                     url (nexus_url + 'central')                 }                 mavenlocal()             }         }     } } 

and in local build.gradle, write

apply plugin: myrepos  buildscript {     dependencies {        ...     } } 

my desire 2 buildscript sections merged such repositories defined in plugin , dependencies in build.gradle, appears local declaration overrides plugin , end error indicating "no repositories defined".

if via configuration injection top level build.gradle, result same?

maybe right solution plugin provide ext closure define usemyrepos() similar way mavencentral() used...

generally configuration items in gradle merged can apply configurations in different locations. can, example, configure of dependencies in 1 build script applied build script add additional dependencies.

however, case bit different since you're using buildscript configuration can used define dependencies build script rather root repositories node intended defining dependencies of project build.

in case, according purpose of buildscript in gradle these different configurations you'll have define dependency twice.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -