diff --git a/build.gradle b/build.gradle index d1b222ca..9e3c1a5d 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ buildscript { } dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion" + classpath libs.org.springframework.boot.spring.boot.gradle.plugin } } diff --git a/buildSrc/src/main/groovy/io/spring/gradle/convention/SpringSamplePlugin.groovy b/buildSrc/src/main/groovy/io/spring/gradle/convention/SpringSamplePlugin.groovy index 2aa2a915..aac49f94 100644 --- a/buildSrc/src/main/groovy/io/spring/gradle/convention/SpringSamplePlugin.groovy +++ b/buildSrc/src/main/groovy/io/spring/gradle/convention/SpringSamplePlugin.groovy @@ -17,6 +17,7 @@ package io.spring.gradle.convention; import org.gradle.api.Project +import org.gradle.api.artifacts.VersionCatalogsExtension import org.sonarqube.gradle.SonarQubePlugin; /** @@ -33,16 +34,16 @@ public class SpringSamplePlugin extends AbstractSpringJavaPlugin { @Override protected void initialPlugins(Project project) { - if (project.hasProperty('springBootVersion')) { - String springBootVersion = project.springBootVersion - + def versionCatalog = project.rootProject.extensions.getByType(VersionCatalogsExtension.class) + .named("libs") + def version = versionCatalog.findVersion("org-springframework-boot") + version.ifPresent { + def springBootVersion = it.displayName if (Utils.isSnapshot(springBootVersion)) { project.ext.forceMavenRepositories = 'snapshot' - } - else if (Utils.isMilestone(springBootVersion)) { + } else if (Utils.isMilestone(springBootVersion)) { project.ext.forceMavenRepositories = 'milestone' } } - } } diff --git a/gradle.properties b/gradle.properties index 74a28248..236c11fc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,3 @@ org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 org.gradle.parallel=true version=3.0.5-SNAPSHOT -springBootVersion=3.0.7 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 56628df9..d091121f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,6 +9,7 @@ org-mockito = "4.8.1" org-mongodb = "4.8.2" org-slf4j = "2.0.9" org-springframework = "6.0.14" +org-springframework-boot = "3.0.7" org-testcontainers = "1.17.6" org-junit = "5.8.2" @@ -67,6 +68,8 @@ org-slf4j-slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "org-slf4j org-springframework-data-spring-data-bom = "org.springframework.data:spring-data-bom:2022.0.12" org-springframework-security-spring-security-bom = "org.springframework.security:spring-security-bom:6.0.8" org-springframework-spring-framework-bom = { module = "org.springframework:spring-framework-bom", version.ref = "org-springframework"} +org-springframework-boot-spring-boot-dependencies = { module = "org.springframework.boot:spring-boot-dependencies", version.ref = "org-springframework-boot" } +org-springframework-boot-spring-boot-gradle-plugin = { module = "org.springframework.boot:spring-boot-gradle-plugin", version.ref = "org-springframework-boot" } org-testcontainers-testcontainers-bom = { module = "org.testcontainers:testcontainers-bom", version.ref = "org-testcontainers" } org-thymeleaf-extras-thymeleaf-extras-springsecurity6 = "org.thymeleaf.extras:thymeleaf-extras-springsecurity6:3.1.2.RELEASE" org-webjars-bootstrap = "org.webjars:bootstrap:2.3.2" diff --git a/spring-session-docs/spring-session-docs.gradle b/spring-session-docs/spring-session-docs.gradle index 2cac0edf..f083d44e 100644 --- a/spring-session-docs/spring-session-docs.gradle +++ b/spring-session-docs/spring-session-docs.gradle @@ -49,6 +49,10 @@ tasks.named("generateAntoraYml") { def generateAttributes() { + def springBootVersion = libs.versions.org.springframework.boot.get() + springBootVersion = springBootVersion.contains("-") + ? springBootVersion.substring(0, springBootVersion.indexOf("-")) + : springBootVersion def ghTag = snapshotBuild ? 'main' : project.version def springBootRefDocs = "https://docs.spring.io/spring-boot/docs/${springBootVersion}/reference/html" return ['gh-tag':ghTag, diff --git a/spring-session-samples/gradle/dependency-management.gradle b/spring-session-samples/gradle/dependency-management.gradle index f8ae6d79..47d91a8f 100644 --- a/spring-session-samples/gradle/dependency-management.gradle +++ b/spring-session-samples/gradle/dependency-management.gradle @@ -1,3 +1,6 @@ +def versionCatalog = extensions.getByType(VersionCatalogsExtension).named("libs") +def springBootVersion = versionCatalog.findVersion("org-springframework-boot").get().displayName + dependencyManagement { imports { mavenBom "org.springframework.boot:spring-boot-dependencies:$springBootVersion"