Giving additional information to a project from settings.gradle


(Björn Kautler) #1

I try to give a project additional information from settings.gradle. What I do is

gradle.rootProject {
   it.project('foo').ext.type = 'java'
   it.project('bar').ext.type = 'doc'
}

in settings.gradle to later use that value for common configuration from the root project like

configure(subprojects.findAll { it.type == 'java' }) {
   apply plugin: 'java'
}

Unfortunately this does not seem to work. Can anyone explain me why and whether this is a bug and / or how to do it properly? This is on Gradle 1.12 currently.


(Björn Kautler) #2

I also tried in settings.gradle

gradle.beforeProject {
   if (it == it.rootProject) {
      it.project('foo').ext.type = 'java'
      it.project('bar').ext.type = 'doc'
   }
}

But that seems to also not work. :frowning:


(Björn Kautler) #3

Oh hell, it works just fine. Both versions. It was just a faulty debug statement that made me search almost the whole day. So unless there is a nicer way to achieve what I want, please close or if possible delete this question.


(Björn Kautler) #4

Oh hell, it works just fine. Both versions. It was just a faulty debug statement that made me search almost the whole day. So unless there is a nicer way to achieve what I want, please close or if possible delete this question.