Configure only subset of subprojects

Is it possible to configure only some subset of the sub projects.

I’m aware of subprojects{} but this applies to all the sub projects. Using project(’:p1’) {}, project(’:p2’){} seems repetitive.

Use case:

We have a number of sub projects, some which should be configured in the same way (dependencies etc). But there are other sub projects which should not use these settings


I suspect there are multiple solutions to this, but mine was to create a list of the subprojects I wanted to customize the configuration for and specify that list when calling configure. An example is below:

project.ext {
    subprojectList = subprojects.findAll{ == 'subprojectA' || == 'subprojectB' || == 'subprojectC'
  configure(project.subprojectList) {
    // insert your custom configuration code
1 Like


Somehow I missed configure()

It’s even mentioned in the user’s guide.

1 Like

You can simply pass projects to configure:

configure([project(':a'), project(':b'), project(':c')]) {
    // configuration

See the DSL reference docs on Project.configure().

1 Like