Naming of settings file across multiple projects

I have a couple of related Gradle projects proj-app, proj-schema and proj-helpers in a common parent directory. I run each Gradle task from the project directory (e.g. proj-app), not the parent directory.

I have some common settings (like repository locations) which I keep in the parent directory. At the moment this file in the parent is called

settings.gradle

like the “real” settings.gradle in the project directory. I source the parent settings.gradle from the real one via

apply from: '../settings.gradle'

This works, but I wonder whether the naming of the parent Settings file with the same name as teh real Settings file is sensible. Some AI bot suggested instead ‘shared-settings.gradle’.

What does the community think, what makes more sense?

Neither. :slight_smile:

Any thing you use with “apply from” is called a “legacy script plugin” and those have quite some quirks and are highly discouraged.
The idiomatic way to have centralized build logic would be to write a convention plugin that you then apply where needed.
So in your case you would have an additional included build where you build your convention settings plugin that does your common logic and then apply that plugin in your projects where you want those conventions to be effective.

1 Like