Giving additional information to a project from settings.gradle

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.

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:

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.

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.