to settings.gradle, any usages of module “com.foo:bar” in the composite project are replaced by the project “:bar” from the included “foo” project.

However, I would like to do the inverse, i.e. replace dependencies in the included project with projects from the composite project. In the above case, “com.foo:bar” would be used in the included “foo” project and should be replaced by the project “:bar” from the composite project.

Substitution works in any direction. Currently there is no way to define the provided substitutions of the main build. But maybe you don’t need to in your case. If project.group and project.name match groupId:artifactId, then substitutions works out of the box.

Otherwise you can create a composite that includes both your builds and then define manual substitutions there.