Setting project name by directory name is inaccurate when you are in a branch


(Gail Stewart) #1

Most source code control tools have a pattern of / - even the main line of source is usually named “main” or “trunk” Our Source tree is no different. The project.name is NEVER useful Having to create a settings.gradle file for every project just to set the project name seems clunky. I don’t do any “multi-project” builds so maybe I would understand it more if I did. I have no expectation that this will be changed, but I wanted to express my opinion.

Gail


(Luke Daley) #2

The way to fix this is to add a file called ‘settings.gradle’ next to your ‘build.gradle’ and have in it:

rootProject.name = “myproject”

This can’t be in the ‘build.gradle’ because Gradle has to know the names/paths to the projects before it starts evaluating ‘build.gradle’ files.

If you care about your project name, you should always do this.