37 lines
1.0 KiB
Plaintext
37 lines
1.0 KiB
Plaintext
![]() |
== Why is this an issue?
|
||
|
|
||
|
`settings.gradle.kts` or `settings.gradle` are used to define general project properties.
|
||
|
|
||
|
It is a good practice to specify the `rootProject.name` property to set your project name and avoid inconsistencies. By default, Gradle uses the project directory name as the project name and this is not guaranteed to always be the desired behavior.
|
||
|
|
||
|
== How to fix it
|
||
|
|
||
|
Add the `rootProject.name` property to the Gradle settings file (i.e. `settings.gradle.kts` or `settings.gradle`)
|
||
|
|
||
|
=== Code examples
|
||
|
|
||
|
==== Noncompliant code example
|
||
|
|
||
|
[source,kotlin,diff-id=1,diff-type=noncompliant]
|
||
|
----
|
||
|
include("module1", "module2")
|
||
|
----
|
||
|
|
||
|
==== Compliant solution
|
||
|
|
||
|
[source,kotlin,diff-id=1,diff-type=compliant]
|
||
|
----
|
||
|
rootProject.name = "myProject"
|
||
|
include("module1", "module2")
|
||
|
----
|
||
|
|
||
|
== Resources
|
||
|
|
||
|
=== Documentation
|
||
|
|
||
|
* https://docs.gradle.org/current/dsl/org.gradle.api.initialization.Settings.html[Settings - Gradle DSL]
|
||
|
|
||
|
=== Standards
|
||
|
|
||
|
* https://youtu.be/hKtO1yGEWvY?list=PL0UJI1nZ56yAHv9H9kZA6vat4N1kSRGis&t=83[Always specify Gradle settings]
|