Skip to content

dallay/starter-gradle

Gradle Template

maven-central-version maven-metadata-url git-hub-release

codacy-grade codecov git-hub-actions-workflow-status

JDK GRADLE KOTLIN NODE

dallay Markdown git-hub-license Ask DeepWiki

πŸ•οΈ Project Template

This repo contains a Gradle project structure with:

  • Centralized and maintainable build configuration and custom build logic
  • No dependency hell through smart dependency management with dependency rules and analysis

The starter project contains everything for a traditional JVM project. The structure though, is good for any kind of project you may build with Gradle (Kotlin, Groovy, Scala, ...).

🧱 Project Overview

You can find a detailed explanation of the project structure in Gradle Basics.

Core Concepts

Gradle Project Structure

Project Structure

project
β”œβ”€β”€ gradle
β”‚   β”œβ”€β”€ libs.versions.toml
β”‚   └── wrapper
β”‚       β”œβ”€β”€ gradle-wrapper.jar
β”‚       └── gradle-wrapper.properties
β”œβ”€β”€ gradlew
β”œβ”€β”€ gradlew.bat
β”œβ”€β”€ settings.gradle(.kts)
β”œβ”€β”€ subproject-a
β”‚   β”œβ”€β”€ build.gradle(.kts)
β”‚   └── src
└── subproject-b
    β”œβ”€β”€ build.gradle(.kts)
    └── src

Build Lifecycle

Build Lifecycle

Configuration Cache

Configuration Cache

The Configuration Cache improves build performance by caching the result of the configuration phase and reusing it for subsequent builds.

Dependency Scopes

https://docs.gradle.org/nightly/userguide/declaring_configurations.html#sec:resolvable-consumable-configs

Mapping between Java module directives and Gradle configurations to declare dependencies: declaring_module_dependencies

🍰 Project Usage

Using Make (Recommended)

This project includes a Makefile with standardized commands that work across all operating systems:

make help              # Show all available commands
make run               # Run the main application
make build             # Build the entire project
make test              # Run all tests
make check             # Run all checks (format, lint, tests)

Quick Reference

Command Description
make run Run the main application (app module)
make build Build the entire project
make build-fast Build without tests (faster)
make test Run all tests
make test-coverage Run tests with coverage report
make format Format all code (Spotless)
make check Run all checks (format + lint + tests)
make clean Clean build artifacts
make deps Show project dependencies

Examples

# Quick development cycle
make format build-fast

# Run specific example
make run-java      # Run Java example
make run-kotlin    # Run Kotlin example
make run-spring    # Run Spring example

# Full CI pipeline
make all          # clean + build + test + check

Using Gradle Directly

You can also run ./gradlew help to get Gradle command-line usage help.

./gradlew help                    # Show Gradle help
./gradlew build                   # Build project
./gradlew app:run                 # Run app module
./gradlew test                    # Run tests
./gradlew check                   # Run all checks

Initial Setup

Make the Gradle wrapper executable:

git update-index --chmod=+x gradlew
# Or use make:
make setup

🏝️ Thanks

This project is heavily inspired by the following awesome projects.

About

Starter template for Gradle

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages