• Stars
    star
    139
  • Rank 262,954 (Top 6 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 2 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

How to structure a growing Gradle project with smart dependency management?

How to set up a larger Gradle project

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:

And here is an overview in a thread on Mastodon:

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

Overview of your Convention Plugins

There is a help task that you can use to get a diagram of the convention plugins defined in the project:

./gradlew :plugins:analysePluginApplicationOrder

The task generates a PlantUML file that you can render, for example, with the PlantUML IntelliJ plugin.

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).

FAQ

List of questions asked in issues so far.

More questions or points you would like to discuss? Please open an issue.

More Repositories

1

idiomatic-gradle

How do I idiomatically structure a large build with Gradle 7.2+?
Java
493
star
2

understanding-gradle

The Understanding Gradle video series introduces the concepts of the Gradle Build Tool one-by-one in short videos.
Java
256
star
3

gradle-plugins-howto

How to write Gradle plugins - answers to common questions and alternative implementation solutions
Java
129
star
4

gradle-demos

A collection of sample builds demonstrating how to do different things in Gradle
Java
51
star
5

gradle-module-metadata-maven-plugin

A Maven plugin to publish Gradle Module Metadata
Java
12
star
6

missing-metadata-guava

A Gradle plugin that provides additional metadata for Guava versions that were not published with Gradle Module Metadata.
Groovy
11
star
7

gradle-jpms-experiments

Kotlin
6
star
8

gradle-dependency-constraints

Kotlin
5
star
9

jjohannes

4
star
10

gradle-workshops

Java
4
star
11

gradle-training

Kotlin
3
star
12

what-if-gradle-metadata

What if... Gradle Module Metadata would have existed when your favorite JVM library was published
Kotlin
3
star
13

behind-the-magic-of-gradle-with-kotlin

2
star
14

java-module-system

Slides and links about Java Module System development with Gradle
Java
2
star
15

playdate-sprite-match

Kotlin
2
star
16

missing-metadata-jackson

A Gradle plugin that adds additional metadata to 2.6.7+ releases of the https://github.com/FasterXML/jackson libraries.
Java
1
star
17

java-magazin-gradle-7

Project used in the Java Magazin article about Gradle 7
Kotlin
1
star
18

gradle-version-attribute

Kotlin
1
star
19

gradle-tooling-api-as-module

Kotlin
1
star
20

dependency-update-playground

Java
1
star
21

java-module-read-all-unnamed

Java
1
star
22

java-magazin-gradle-6

Project used in the Java Magazin article about Gradle 6
Kotlin
1
star
23

plain-c

Java
1
star