gradle-project-setup-howto

Introduction: How to structure a growing Gradle project with smart dependency management?
More: Author   ReportBugs   
Tags:

This repo shows one possibility to structure a Gradle project when you want:

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

There are four variations of this available:

The structure though, is good for any kind of project you may build with Gradle (Kotlin, Groovy, Scala, ...)

This is following the same patterns as idiomatic-gradle but is closer to a full setup that also takes the aspect of continuously changing dependencies into account.

Pick one of these similar videos to get a quick overview:

Project Overview

Different structuring concerns are summarized in commits if you like to explore things one-by-one:

Any kind of project

Any kind of project (except Java Module System)

Android projects

  • Android plugins
    Here, the Application plugins are changed into Android plugins and adjusted to target Android App development using the Android Gradle Plugins.
    • This repo focuses on general project structuring and dependency management with Gradle and does not go into many Android specifics. I recommend to check out https://github.com/android/nowinandroid in addition for that.

Java Module System projects

Kotlin JVM projects

Notes

  • If you have a question, please ask in an issue.
  • The concrete things done in all places (custom tasks, components used in dependencies, additional plugins applied, etc.) are just examples. If you, for example, need to use additional Gradle plugins you can add these in the corresponding place, keeping the suggested structure.
  • This setup uses a platform project to centralize dependency versions. An alternative approach is to use a dependency version catalog. If you prefer to use a catalog, because it is the better fit in your case, you can still follow the setup proposed here (just without the gradle/platform project).
Apps
About Me
GitHub: Trinea
Facebook: Dev Tools