GithubHelp home page GithubHelp logo

cxwudi / modern-gradle-template-simplified Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 149 KB

A simplified version of https://github.com/CXwudi/modern-gradle-template with less boiler code. Suitable for using as a starting template.

License: MIT License

modern-gradle-template-simplified's Introduction

Simplified Modern Gradle Template

This is the simplified version of my Modern Gradle Template that suites for using as a GitHub template.

The structure of the template stays the same but less boiler stuff to be deleted.

Features

This template can be used to create new spring/quarkus/micronaut/etc. projects, or to create new libraries. No matter it is single-module or multi-module, it is easy to start with this template.

Advantages:

  1. Centralized version management by version catalog and gradle platform (together cover any version declaration in the main build script, and plugins and dependencies blocks in precompiled script plugins, without any hacks)
  2. Composite build, not buildSrc (Although it doesn't matter anymore since Gradle 8.0)
  3. Composition over Inheritance using mixin plugins and convention plugins to maximize parallel build performance

How to use

  1. Modify the project name rootProject.name in settings.gradle.kts to your own project name.
  2. Add your own mixin plugins and convention plugins, if you want to start from scratch, you can delete all preexisting mixin and convention plugins. Remember to archive centralized version management by adding your own libraries into the version catalog.
    • Tip 1: if you want to use version catalog in the dependencies block in precompiled script plugins (mixin or convention plugins), put them in the constraints block in the dev-version-constraints platform. Then in precompiled script plugins, declare the library dependency without the version (e.g. implementation("org.springframework.boot:spring-boot-starter")). This works for Maven bom and Gradle platform as well.
    • Tip 2: if you want to use version catalog in the plugins block in precompiled script plugins (mixin or convention plugins), you instead let the build.gradle.kts (is also the one with kotlin-dsl applied) that build the precompiled script plugin applies the version catalog. Then in precompiled script plugins, declare the library dependency without the version ((e.g. id("org.springframework.boot"))
    • Tip 3: there is a little kotlin-jvm mixin plugin that demonstrates the above two tips.
  3. Delete the sample submodules beginning with sample-, and start adding your own submodules. Or you can reuse them by renaming them as it only contains a single build.gradle.kts file.
  4. (Optional) The template contains a renovate bot config file to automatically update dependencies in the version catalog. You can delete it if you don't need it.

TODO

modern-gradle-template-simplified's People

Contributors

cxwudi avatar renovate[bot] avatar

Watchers

 avatar

modern-gradle-template-simplified's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

docker-compose
docker/compose.gradle-test.yml
github-actions
.github/workflows/gradle.yml
  • actions/checkout v4
  • actions/setup-java v4
  • gradle/gradle-build-action v3
  • actions/checkout v4
  • actions/setup-java v4
  • gradle/gradle-build-action v3
gradle
gradle.properties
settings.gradle.kts
build.gradle.kts
gradle/libs.versions.toml
  • org.jetbrains.kotlinx:kotlinx-coroutines-bom 1.8.1
  • org.jetbrains.kotlin:kotlin-gradle-plugin 2.0.10
  • com.gradle.develocity:com.gradle.develocity.gradle.plugin 3.17.6
  • org.gradle.toolchains:foojay-resolver 0.8.0
  • io.mockk:mockk 1.13.12
  • org.jetbrains.kotlin.jvm 2.0.10
gradle/platform/settings.gradle.kts
gradle/platform/dev-version-constraints/build.gradle.kts
gradle/plugins/settings.gradle.kts
gradle/plugins/convention/kotlin-app/build.gradle.kts
gradle/plugins/convention/kotlin-app/src/main/kotlin/my.kotlin-jvm-app.gradle.kts
gradle/plugins/convention/kotlin-lib/build.gradle.kts
gradle/plugins/convention/kotlin-lib/src/main/kotlin/my.kotlin-jvm-lib.gradle.kts
gradle/plugins/mixin/app/build.gradle.kts
gradle/plugins/mixin/app/src/main/kotlin/my/mixin/app.gradle.kts
gradle/plugins/mixin/kotlin-jvm/build.gradle.kts
gradle/plugins/mixin/kotlin-jvm/src/main/kotlin/my/mixin/kotlin-jvm.gradle.kts
gradle/plugins/mixin/lib/build.gradle.kts
gradle/plugins/mixin/lib/src/main/kotlin/my/mixin/lib.gradle.kts
gradle/plugins/root/build.gradle.kts
gradle/plugins/root/src/main/kotlin/my/root/jvm.gradle.kts
gradle/settings/settings.gradle.kts
gradle/settings/root-settings-plugins/build.gradle.kts
gradle/settings/root-settings-plugins/src/main/kotlin/my.root-settings-plugins.settings.gradle.kts
sample-kotlin-app/build.gradle.kts
sample-kotlin-lib/build.gradle.kts
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.10

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.