11plugins {
22 java
3- id(" com.diffplug.eclipse.apt" ) version " 4.2.0"
4- id(" com.diffplug.spotless" ) version " 7.0.2"
5- id(" org.domaframework.doma.compile" ) version " 3.0.1"
3+ alias(libs.plugins.eclipse.apt)
4+ alias(libs.plugins.spotless)
5+ alias(libs.plugins.doma.compile)
6+ }
7+
8+ // Retain a reference to rootProject.libs to make the version catalog accessible within allprojects and subprojects.
9+ // See https://github.com/gradle/gradle/issues/16708
10+ val catalog = libs
11+
12+ allprojects {
13+ apply (plugin = " base" )
14+ apply (plugin = catalog.plugins.spotless.get().pluginId)
15+
16+ repositories {
17+ mavenCentral()
18+ mavenLocal()
19+ maven(url = " https://oss.sonatype.org/content/repositories/snapshots/" )
20+ }
21+
22+ spotless {
23+ lineEndings = com.diffplug.spotless.LineEnding .UNIX
24+ java {
25+ googleJavaFormat(catalog.google.java.format.get().version)
26+ }
27+ kotlinGradle {
28+ ktlint(catalog.ktlint.get().version)
29+ }
30+ format(" misc" ) {
31+ target(" **/*.gitignore" , " **/*.md" )
32+ targetExclude(" **/bin/**" , " **/build/**" )
33+ leadingTabsToSpaces()
34+ trimTrailingWhitespace()
35+ endWithNewline()
36+ }
37+ }
38+
39+ tasks {
40+ build {
41+ dependsOn(spotlessApply)
42+ }
43+ }
644}
745
846subprojects {
947 apply (plugin = " java" )
10- apply (plugin = " com.diffplug .eclipse.apt" )
11- apply (plugin = " com.diffplug .spotless" )
12- apply (plugin = " org.domaframework .doma.compile" )
48+ apply (plugin = catalog.plugins .eclipse.apt.get().pluginId )
49+ apply (plugin = catalog.plugins .spotless.get().pluginId )
50+ apply (plugin = catalog.plugins .doma.compile.get().pluginId )
1351
1452 java {
1553 toolchain {
@@ -27,29 +65,24 @@ subprojects {
2765 }
2866 }
2967
30- repositories {
31- mavenCentral()
32- mavenLocal()
33- maven(url = " https://oss.sonatype.org/content/repositories/snapshots/" )
34- }
35-
3668 dependencies {
37- val domaVersion: String by project
38- annotationProcessor(" org.seasar.doma:doma-processor:${domaVersion} " )
39- implementation(" org.seasar.doma:doma-core:${domaVersion} " )
40- implementation(" org.seasar.doma:doma-slf4j:${domaVersion} " )
41- runtimeOnly(" ch.qos.logback:logback-classic:1.5.16" )
42- runtimeOnly(" com.h2database:h2:2.3.232" )
43- testImplementation(" org.junit.jupiter:junit-jupiter-api:5.11.4" )
44- testRuntimeOnly(" org.junit.jupiter:junit-jupiter-engine:5.11.4" )
69+ annotationProcessor(catalog.doma.processor)
70+ implementation(catalog.doma.core)
71+ implementation(catalog.doma.slf4j)
72+ runtimeOnly(catalog.logback.classic)
73+ runtimeOnly(catalog.jdbc.h2)
74+ testImplementation(catalog.junit.jupiter.api)
75+ testRuntimeOnly(catalog.junit.jupiter.engine)
4576 }
4677
4778 eclipse {
4879 classpath {
4980 file {
5081 whenMerged {
5182 val classpath = this as org.gradle.plugins.ide.eclipse.model.Classpath
52- val folder = org.gradle.plugins.ide.eclipse.model.SourceFolder (" .apt_generated" , " bin/main" )
83+ val folder =
84+ org.gradle.plugins.ide.eclipse.model
85+ .SourceFolder (" .apt_generated" , " bin/main" )
5386 classpath.entries.add(folder)
5487 val dir = file(folder.path)
5588 if (! dir.exists()) {
@@ -65,10 +98,4 @@ subprojects {
6598 // Reset all Eclipse settings when "Refresh Gradle Project" is executed
6699 synchronizationTasks(" cleanEclipse" , " eclipse" )
67100 }
68-
69- spotless {
70- java {
71- googleJavaFormat(" 1.23.0" )
72- }
73- }
74101}
0 commit comments