Subproject filtering


(Sion Williams) #1

I have a project with the following layout.

MyProject
|
|- java
|- db
    |--schemaA
          build.gradle
    |--schemaB
          build.gradle
|-build.gradle
|-settings.gradle

I would like to apply my database tasks to the ‘db’ subprojects only and so did the following:

configure(subprojects.findAll{it.name.contains(':db:')}){
    apply from: "$rootDir/gradle/dbdeploy.gradle"
}

but this didn’t show the tasks with ‘gradle tasks’ within the schemaA directory.

my settings.gradle is configured as follows:

include 'java'
include 'db:schemaA'
  rootProject.name = 'MyProject'

(Peter Niederwieser) #2

You’ll need to use ‘it.path.contains’ rather than ‘it.name.contains’.