How to evaluate configure(projects) after subprojects{}

In my multi-project build, in the root build.gradle, I’d like to add some custom configuration for selected projects to be evaluated after the subprojects{} block. Putting that section last in the file doesn’t accomplish that - I get an error showing that a plugin applied in the subprojects block is not yet applied when the configure(selected){} block is run. Nesting the configure(selected) block within subprojects{} doesn’t work either; everything in the block is evaluated for all subprojects. So how is it done?

That should work.

Here’s an example:


subprojects {
   apply plugin: 'java'
   println "Configuring $name"

def someProjects = subprojects.findAll {"special") }

configure(someProjects) {
   println "Configuring $name special"
   jar {
      // configure jar task
      println "Configuring jar for $"

task print


include 'specialA', 'B', 'specialC', 'D'

gradle print produces this output:

Configuring B
Configuring D
Configuring specialA
Configuring specialC
Configuring specialA special
Configuring jar for specialA
Configuring specialC special
Configuring jar for specialC