Slackbot
01/23/2024, 10:59 AMVampire
01/23/2024, 11:02 AMBernhard Posselt
01/23/2024, 11:04 AMdependencies {
implementation(libs.kotlin.jvm)
implementation(libs.kotlin.kapt)
implementation(libs.gradle.versions)
implementation(libs.kotlin.spring.boot)
implementation(libs.spring.boot)
implementation(libs.spring.boot.dependency.management)
}Bernhard Posselt
01/23/2024, 11:05 AMdependencyResolutionManagement {
versionCatalogs {
create("libs") {
version("spring", "3.2.2")
version("kotlin", "1.9.22")
library(
"spring-boot",
"org.springframework.boot",
"org.springframework.boot.gradle.plugin"
).versionRef("spring")
library(
"spring-boot-dependency-management",
"io.spring.dependency-management:io.spring.dependency-management.gradle.plugin:1.1.4"
)
library(
"kotlin-spring-boot",
"org.jetbrains.kotlin.plugin.spring",
"org.jetbrains.kotlin.plugin.spring.gradle.plugin"
).versionRef("kotlin")
library(
"kotlin-jvm",
"org.jetbrains.kotlin.jvm",
"org.jetbrains.kotlin.jvm.gradle.plugin"
).versionRef("kotlin")
library(
"kotlin-kapt",
"org.jetbrains.kotlin.kapt",
"org.jetbrains.kotlin.kapt.gradle.plugin"
).versionRef("kotlin")
library(
"gradle-versions",
"com.github.ben-manes.versions:com.github.ben-manes.versions.gradle.plugin:0.49.0"
)
}
}Bernhard Posselt
01/23/2024, 11:05 AMBernhard Posselt
01/23/2024, 11:06 AMBernhard Posselt
01/23/2024, 11:06 AMVampire
01/23/2024, 11:06 AMBernhard Posselt
01/23/2024, 11:06 AMBernhard Posselt
01/23/2024, 11:07 AMBernhard Posselt
01/23/2024, 11:07 AMVampire
01/23/2024, 11:08 AMbuildSrc, you could simply use a version catalog as TOML file (recommended / preferred anyway) and use that TOML as version catalog in both builds, the buildSrc build and the main build, then you can use the version catalog entries as you intended to.Vampire
01/23/2024, 11:08 AMVampire
01/23/2024, 11:09 AMplatform(...)Bernhard Posselt
01/23/2024, 11:10 AMBernhard Posselt
01/23/2024, 11:11 AMVampire
01/23/2024, 11:11 AMVampire
01/23/2024, 11:11 AMVampire
01/23/2024, 11:11 AMBernhard Posselt
01/23/2024, 11:12 AMVampire
01/23/2024, 11:12 AMgradle/libs.versions.toml which is the conventional place and thus gets used automatically and then include it explicitly in buildSrc/settings.gradle.kts, then this is the only place where you include it explicitlyVampire
01/23/2024, 11:13 AMok, so in each project's settings.gradle.kts that uses the convention plugin?You only have one
Vampire
01/23/2024, 11:14 AMbuildSrc you can only use it in its owning build.
So you only need it in one place as describedBernhard Posselt
01/23/2024, 11:14 AMBernhard Posselt
01/23/2024, 11:14 AMVampire
01/23/2024, 11:15 AMbuildSrc, not an included buildVampire
01/23/2024, 11:16 AMBernhard Posselt
01/23/2024, 11:16 AMBernhard Posselt
01/23/2024, 11:16 AMVampire
01/23/2024, 11:16 AMBernhard Posselt
01/23/2024, 11:16 AMBernhard Posselt
01/23/2024, 11:16 AMVampire
01/23/2024, 11:17 AMI meant that more as the build step mechanism similar to thatYeah, that's a bit unlucky, as it might sometimes change the answers, as there are slight differences. 😉
Thomas Broyer
01/23/2024, 11:56 AMkotlin.coreLibrariesVersion that defaults to the plugin version.Bernhard Posselt
01/23/2024, 11:57 AMThomas Broyer
01/23/2024, 12:03 PMkotlin() method will generate a groupId:artifactId without version, and an action fixes the missing version before resolution: https://github.com/JetBrains/kotlin/blob/d04b3050c005701bf6d237c52454c995622a60c9/[…]etbrains/kotlin/gradle/internal/KotlinDependenciesManagement.ktJavi
01/23/2024, 2:05 PMJavi
01/23/2024, 2:06 PMtestImplementation(“org.jetbrains.kotlin:kotlin-test”)Javi
01/23/2024, 2:07 PMgetKotlinVersion() function tooBernhard Posselt
01/23/2024, 2:07 PM