Skip to content

Commit 0188923

Browse files
committedMar 19, 2025
Get Spring Boot version from project property instead of system property
1 parent a564439 commit 0188923

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed
 

‎src/main/kotlin/by/andd3dfx/build/Dependencies.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ abstract class Starters(
5757
}
5858

5959
class SpringBootStarters(
60-
val dependencyHandlerScope: DependencyHandlerScope
60+
val dependencyHandlerScope: DependencyHandlerScope,
61+
private val dependencyVersions: DependencyVersions
6162
) : Starters(dependencyHandlerScope, "org.springframework.boot") {
6263

6364
fun springBoot() = implementation("org.springframework.boot:spring-boot-starter")
@@ -107,11 +108,12 @@ class SpringCloudStarters(
107108
}
108109

109110
fun DependencyHandlerScope.springBoot(
110-
version: String = DependencyVersions.SPRING_BOOT,
111+
project: org.gradle.api.Project,
111112
body: SpringBootStarters.() -> Unit = {}
112113
) {
113-
implementation(platform("org.springframework.boot:spring-boot-dependencies:${version}"))
114-
SpringBootStarters(this).init(body)
114+
val dependencyVersions = DependencyVersions(project)
115+
implementation(platform("org.springframework.boot:spring-boot-dependencies:${dependencyVersions.SPRING_BOOT}"))
116+
SpringBootStarters(this, dependencyVersions).init(body)
115117
}
116118

117119
fun DependencyHandlerScope.lombok(version: String = DependencyVersions.LOMBOK) {
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
package by.andd3dfx.build
22

3-
class DependencyVersions {
3+
import org.gradle.api.Project
4+
5+
class DependencyVersions(private val project: Project) {
46
companion object {
57
const val LOMBOK = "1.18.30"
6-
val SPRING_BOOT: String = System.getProperty("springBootVersion")
78
const val SPRING_CLOUD = "2023.0.0"
89
const val MAP_STRUCT = "1.5.5.Final"
910
const val SPRING_DOC = "1.7.0"
1011
const val SWAGGER = "1.6.12"
1112
const val POSTGRES = "42.7.1"
1213
const val TEST_CONTAINERS = "1.19.3"
1314
}
14-
}
1515

16-
class ApiVersion {
17-
companion object {
18-
}
16+
val SPRING_BOOT: String
17+
get() = project.property("springBootVersion").toString()
1918
}

0 commit comments

Comments
 (0)