A Gradle settings plugin that provides a hierarchical DSL for organizing and auto-creating multi-module project structures.
- π³ Hierarchical DSL for module organization
- π Automatic directory creation
- π Automatic module inclusion in Gradle
- β‘οΈ Type-safe project accessors support (automatically enabled)
Add the plugin to your settings.gradle.kts file:
plugins {
id(id = "dev.g000sha256.gradle-module-tree") version "1.1.1"
}Define your directories and modules in the settings.gradle.kts file. They will be created and included after syncing
the project:
include {
module(name = "app")
directory(name = "core") {
module(name = "architecture")
module(name = "di")
module(name = "resources")
module(name = "ui")
}
directory(name = "features") {
directory(name = "main") {
module(name = "data")
module(name = "domain")
module(name = "presentation")
}
directory(name = "profile") {
module(name = "data")
module(name = "domain")
module(name = "presentation")
}
}
directory(name = "utils") {
module(name = "coroutines")
}
}This creates the following project structure:
project
βββ app
βββ core
β βββ architecture
β βββ di
β βββ resources
β βββ ui
βββ features
β βββ main
β β βββ data
β β βββ domain
β β βββ presentation
β βββ profile
β βββ data
β βββ domain
β βββ presentation
βββ utils
βββ coroutines
Then reference modules in dependencies using type-safe accessors:
dependencies {
implementation(dependencyNotation = projects.core.architecture)
implementation(dependencyNotation = projects.core.resources)
implementation(dependencyNotation = projects.utils.coroutines)
}Warning
This plugin automatically enables the incubating Gradle TYPESAFE_PROJECT_ACCESSORS feature.