Skip to content

Commit d591edc

Browse files
nakamura-toclaude
andcommitted
Migrate to Gradle version catalog for dependency management
- Create gradle/libs.versions.toml with all dependency versions - Update root and codegen build.gradle.kts to use version catalog - Configure codegen module to reference parent version catalog - Remove redundant plugin version declarations - Centralize dependency version management for better maintainability 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 02caefe commit d591edc

File tree

4 files changed

+94
-31
lines changed

4 files changed

+94
-31
lines changed

build.gradle.kts

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import org.seasar.doma.gradle.codegen.desc.LanguageType
22

33
plugins {
4-
id("java")
5-
id("org.jetbrains.kotlin.jvm") version "2.2.0"
6-
id("org.domaframework.doma.compile") version "4.0.0"
4+
java
5+
alias(libs.plugins.kotlin.jvm)
6+
alias(libs.plugins.doma.compile)
7+
alias(libs.plugins.release)
78
id("org.domaframework.doma.codegen")
8-
id("com.nocwriter.runsql") version "1.0.3"
9-
id("net.researchgate.release") version "3.1.0"
109
}
1110

1211
configure<net.researchgate.release.ReleaseExtension> {
@@ -27,24 +26,22 @@ repositories {
2726
}
2827

2928
dependencies {
30-
val domaVersion: String by project
31-
32-
implementation("org.seasar.doma:doma-core:$domaVersion")
33-
annotationProcessor("org.seasar.doma:doma-processor:$domaVersion")
29+
implementation(libs.doma.core)
30+
annotationProcessor(libs.doma.processor)
3431

3532
// Use JUnit BOM for version management
36-
testImplementation(platform("org.junit:junit-bom:5.13.2"))
37-
testImplementation("org.junit.jupiter:junit-jupiter-api")
38-
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
39-
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
33+
testImplementation(platform(libs.junit.bom))
34+
testImplementation(libs.junit.jupiter.api)
35+
testRuntimeOnly(libs.junit.jupiter.engine)
36+
testRuntimeOnly(libs.junit.platform.launcher)
4037

41-
testRuntimeOnly(platform("org.testcontainers:testcontainers-bom:1.21.2"))
42-
testRuntimeOnly("org.testcontainers:postgresql")
43-
testRuntimeOnly("org.postgresql:postgresql:42.7.7")
38+
testRuntimeOnly(platform(libs.testcontainers.bom))
39+
testRuntimeOnly(libs.testcontainers.postgresql)
40+
testRuntimeOnly(libs.postgresql)
4441

45-
domaCodeGen(platform("org.testcontainers:testcontainers-bom:1.21.2"))
46-
domaCodeGen("org.testcontainers:postgresql")
47-
domaCodeGen("org.postgresql:postgresql:42.7.7")
42+
domaCodeGen(platform(libs.testcontainers.bom))
43+
domaCodeGen(libs.testcontainers.postgresql)
44+
domaCodeGen(libs.postgresql)
4845
}
4946

5047
val initScript = file("init_postgresql.sql")

codegen/build.gradle.kts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
plugins {
2-
id("groovy")
3-
id("java-gradle-plugin")
4-
id("com.diffplug.spotless") version "7.0.4"
5-
id("com.gradle.plugin-publish") version "1.3.1"
2+
groovy
3+
`java-gradle-plugin`
4+
alias(libs.plugins.spotless)
5+
alias(libs.plugins.plugin.publish)
66
}
77

88
gradlePlugin {
@@ -32,7 +32,7 @@ sourceSets {
3232

3333
spotless {
3434
java {
35-
googleJavaFormat("1.23.0")
35+
googleJavaFormat(libs.versions.googleJavaFormat.get())
3636
}
3737
groovy {
3838
}
@@ -50,15 +50,15 @@ repositories {
5050
}
5151

5252
dependencies {
53-
implementation("org.freemarker:freemarker:2.3.34")
54-
testImplementation("org.seasar.doma:doma-core:3.9.1")
53+
implementation(libs.freemarker)
54+
testImplementation(libs.doma.core)
5555

5656
// Use JUnit BOM for version management
57-
testImplementation(platform("org.junit:junit-bom:5.13.2"))
58-
testImplementation("org.junit.jupiter:junit-jupiter-api")
59-
testImplementation("org.junit.jupiter:junit-jupiter-params")
60-
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
61-
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
57+
testImplementation(platform(libs.junit.bom))
58+
testImplementation(libs.junit.jupiter.api)
59+
testImplementation(libs.junit.jupiter.params)
60+
testRuntimeOnly(libs.junit.jupiter.engine)
61+
testRuntimeOnly(libs.junit.platform.launcher)
6262
}
6363

6464
tasks {

codegen/settings.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
11
rootProject.name = "codegen"
2+
3+
dependencyResolutionManagement {
4+
versionCatalogs {
5+
create("libs") {
6+
from(files("../gradle/libs.versions.toml"))
7+
}
8+
}
9+
}

gradle/libs.versions.toml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
[versions]
2+
# Core dependencies
3+
doma = "3.9.1"
4+
freemarker = "2.3.34"
5+
postgresql = "42.7.7"
6+
7+
# Testing
8+
junit = "5.13.2"
9+
testcontainers = "1.21.2"
10+
11+
# Plugins
12+
kotlin = "2.2.0"
13+
domaCompile = "4.0.0"
14+
runsql = "1.0.3"
15+
release = "3.1.0"
16+
spotless = "7.0.4"
17+
pluginPublish = "1.3.1"
18+
19+
# Code formatting
20+
googleJavaFormat = "1.23.0"
21+
22+
[libraries]
23+
# Doma framework
24+
doma-core = { group = "org.seasar.doma", name = "doma-core", version.ref = "doma" }
25+
doma-processor = { group = "org.seasar.doma", name = "doma-processor", version.ref = "doma" }
26+
27+
# Template engine
28+
freemarker = { group = "org.freemarker", name = "freemarker", version.ref = "freemarker" }
29+
30+
# Database drivers
31+
postgresql = { group = "org.postgresql", name = "postgresql", version.ref = "postgresql" }
32+
33+
# Testing - BOMs
34+
junit-bom = { group = "org.junit", name = "junit-bom", version.ref = "junit" }
35+
testcontainers-bom = { group = "org.testcontainers", name = "testcontainers-bom", version.ref = "testcontainers" }
36+
37+
# Testing - Libraries (versions managed by BOMs)
38+
junit-jupiter-api = { group = "org.junit.jupiter", name = "junit-jupiter-api" }
39+
junit-jupiter-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine" }
40+
junit-jupiter-params = { group = "org.junit.jupiter", name = "junit-jupiter-params" }
41+
junit-platform-launcher = { group = "org.junit.platform", name = "junit-platform-launcher" }
42+
testcontainers-postgresql = { group = "org.testcontainers", name = "postgresql" }
43+
44+
[plugins]
45+
# Kotlin
46+
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
47+
48+
# Doma
49+
doma-compile = { id = "org.domaframework.doma.compile", version.ref = "domaCompile" }
50+
51+
# Release management
52+
release = { id = "net.researchgate.release", version.ref = "release" }
53+
54+
# Code quality
55+
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
56+
57+
# Publishing
58+
plugin-publish = { id = "com.gradle.plugin-publish", version.ref = "pluginPublish" }

0 commit comments

Comments
 (0)