in settings.gradle vs projectName in build.gradle

(Gaurav Singh) #1

What is the different between = “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.

(Peter Niederwieser) #2

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

(Gaurav Singh) #3

I see. Thank you.

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

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

(Peter Niederwieser) #4

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.