What is the best way to build all modules under a folder in a multi-module project?

What is the best way to build all modules under a folder? For a simplified example, given the following settings.gradle:

include ‘:foo:bar’ include ‘:foo:bar2’ include ‘:foo:bar3’ include ‘:other:other1’ include ‘:other:other2’ …

I want to build everything under ‘foo’, while ignoring things under ‘other’ (unless they are dependencies of course, which is fine).

I am looking for something along the lines of "gradle :foo::mytask" or “gradle :foo:mytask” I don’t want to explicitly list out all of the :foo: things. The point of this is we have a build server which is set to build everything under foo (explicitly listing the modules right now). When we add a new module under foo, the build server configuration needs updated, and other people on another branch will instantly break since they don’t have that module yet.

The only thing I can think of is to make ‘foo’ a module itself, which is basically an empty build.gradle with task-passthrough to the modules underneath it.

Any thoughts on a better solution? Thanks!

You could make ‘foo’ a module and define a task rule which simply, for any given task, defines a task which depends on the same task on each of the project’s subprojects.

https://www.gradle.org/docs/current/userguide/more_about_tasks.html#N10FE1

Yeah, that is what I meant by the task-passthrough after making ‘foo’ itself a module.

Definitely a solution, I was just hoping there was some awesome gradle notation I could use to build everything in a certain “group” of modules (or whatever they call the initial segments of a multi-colon-segment-module)

Thanks!

No, unfortunately there is no “wildcard” notation for executing tasks.