https://kotlinlang.org logo
Title
m

Marcus Cvjeticanin

03/10/2023, 4:27 PM
Hi, I'm trying to prepare my Kotlin project (ofc using Kotlin DSL with Gradel) to publish on Maven Central. However that is not my question. My question is that, if I have some plugins or other general build tool configuration that I want all other subprojects to inherit. Can I in my root build.gradle.kts define it and all other projects will get the same config? In my root, I have settings.gradle.kts:
include ("library-dir")
Will all of the includes get this? Or how can I do this if not? I just want to avoid writing the same config on several places. Follow-up question regarding the publishing part: • Should I have different versions of the libraries of my SDK? I saw that for example Ktor has the same versions for all libraries since they use a variable to define as
$ktor_version
implementation("io.ktor:ktor-client-core:$ktor_version")
implementation("io.ktor:ktor-client-cio:$ktor_version")
Or should I put all code based on this example in the root and include the subprojects? https://docs.gradle.org/current/userguide/publishing_maven.html#publishing_maven:complete_example ?
c

CLOVIS

03/10/2023, 5:18 PM
It's called a convention plugin: https://docs.gradle.org/current/samples/sample_convention_plugins.html It's very easy to setup, and it allows you to share configuration between any projects you want
m

Marcus Cvjeticanin

03/10/2023, 9:38 PM
Thanks! Just what I looked for!