rootProject.name in settings.gradle vs projectName in build.gradle

What is the different between rootProject.name = “TradeData” in settings.gradle and

def projectName = “TradeData”. Both are in the same directory TradeData. We have multiple sub projects each having their own gradle scripts and projectName values.

‘def projectName’ declares a local variable that per se, doesn’t have any meaning to Gradle.

I see. Thank you.

It looks like project.name in build.gradle populated from containing directory name or settings.gradle : rootProject.name value.

This implies that we MUST have settings.gradle (specifying rootProject.name ) for CI builds ( considering checkout directory names are random )

1 Like

That’s correct. Project names can only be set in ‘settings.gradle’; they are read-only in build scripts. And yes, you do want to nail down the root project name to avoid issues on (say) CI.