Build Tool - Gradle β
Gradle was chosen as the build tool for this project because it better meets the needs of a modular, scalable, CI/CD automation-oriented project than alternatives like Maven.
π οΈ Concepts Used in the Project β
ποΈ Automatic Detection of New Gradle Modules β
The project uses Gradle automatic multi-project includes to:
- Automatically detects new modules placed inside
tech-starters/backend/
ordrinkit/
. - Avoids manual maintenance of the
settings.gradle.kts
file. - Enables effortless scalability, useful for hexagonal or modular architectures.
π¦ Version Catalog β
To centralize and standardize dependency version management, we use Version Catalog with two TOML files:
libs.versions.toml
β
- Contains versions of dependencies used at runtime and for testing.
- Centralizes versions for
jooq
,junit
, etc.
plugins.versions.toml
β
- Contains versions of plugins used during compilation (e.g.,
kotlin
,spring-boot
, ...). - Allows clean plugin version management without duplication across
build.gradle.kts
files.
Benefits:
β
Centralized and visible version management
β
Easy version updates in a single location
β
Consistent dependency alignment across all modules
π Gradle Platforms (to be implemented) β
We plan to introduce Gradle Platforms to:
- Define an internal BOM for aligning dependency versions across all modules.
- Reduce version drift and prevent runtime errors due to incompatibilities.
- Expose declarative dependency constraints for external consumers.
π§© Gradle Conventions β
To maintain consistency, we use modular Gradle Conventions to factor shared configurations across modules:
common-no-dep-convention
β
- Defines generic shared configurations (e.g., JVM version, Kotlin compilation, encoding, test strategy).
- Dependency-free and included by all other conventions.
library-convention
β
- Used for library projects (domain, infrastructure, ...).
- Includes
common-no-dep-convention
+ tech-starters dependencies. - Configures the project as a internal library.
api-convention
β
- Used for Spring Boot applications.
- Includes
common-no-dep-convention
+ necessary dependencies (spring-boot-starter-web
, tech-starters, etc.).
test / test-fixtures-convention
β
- Configures unit and integration test behaviors.
- Manages test dependencies (
testcontainers
,spring-boot-starter-test
, ...). - Structures
testFixtures
for modules.
openapi-contract-convention
β
- Defines a standard project structure for OpenAPI contracts.
contract-first-convention
β
- Configures server code generation from OpenAPI contracts.
- Integrates generation tools (
openapi-generator
) to automatically produce server code (controllers, models, delegates, ...) aligned with the contracts.
code-analysis-convention
β
Configures tools required for static code analysis:
- Linters (
Detekt
,ktlint
). - Cyclomatic complexity checks.
- Security analysis (
dependency-check
, etc.). - Automatically generates reports during build phases or CI pipelines.
- ...
TIP
More Gradle best practices here