forked from ccmjga/mjga-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
167 lines (151 loc) · 6.32 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import org.jooq.meta.jaxb.ForcedType
import org.jooq.meta.jaxb.Logging
plugins {
java
jacoco
id("org.springframework.boot") version "3.2.1"
id("io.spring.dependency-management") version "1.1.0"
id("org.springdoc.openapi-gradle-plugin") version "1.6.0"
id("pmd")
id("nu.studer.jooq") version "8.2"
id("com.diffplug.spotless") version "6.18.0"
}
group = "com.mjga"
version = "1.0"
java.sourceCompatibility = JavaVersion.VERSION_17
configurations {
compileOnly {
extendsFrom(configurations.annotationProcessor.get())
}
}
repositories {
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-jooq")
implementation("org.springframework.boot:spring-boot-starter-mail")
implementation("org.springframework.boot:spring-boot-starter-cache")
implementation("org.springframework.boot:spring-boot-starter-quartz")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-websocket")
implementation("org.springframework.boot:spring-boot-starter-aop")
implementation("org.springframework.boot:spring-boot-starter-data-redis")
implementation("org.apache.commons:commons-lang3:3.13.0")
implementation("org.apache.commons:commons-collections4:4.4")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0")
implementation("org.jooq:jooq-codegen:3.18.6")
implementation("org.jooq:jooq-meta:3.18.6")
implementation("com.auth0:java-jwt:4.4.0")
implementation("com.github.ben-manes.caffeine:caffeine:3.1.8")
implementation("org.testcontainers:junit-jupiter:1.19.0")
implementation("org.testcontainers:postgresql:1.19.0")
implementation("org.testcontainers:testcontainers-bom:1.19.0")
runtimeOnly("org.postgresql:postgresql")
compileOnly("org.projectlombok:lombok")
developmentOnly("org.springframework.boot:spring-boot-devtools")
developmentOnly("org.springframework.boot:spring-boot-docker-compose")
testImplementation("org.springframework.boot:spring-boot-testcontainers")
testImplementation("org.springframework.boot:spring-boot-docker-compose")
testImplementation("org.springframework.boot:spring-boot-starter-webflux")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.security:spring-security-test")
jooqGenerator("org.postgresql:postgresql")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
annotationProcessor("org.projectlombok:lombok")
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.test {
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
}
tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating the report
}
jacoco {
toolVersion = "0.8.9"
reportsDirectory.set(layout.buildDirectory.dir("reports/jacoco/test"))
}
pmd {
isConsoleOutput = true
toolVersion = "6.55.0"
rulesMinimumPriority.set(5)
ruleSetFiles = files("pmd-rules.xml")
}
spotless {
format("misc") {
// define the files to apply `misc` to
target("*.gradle.kts", "*.md", ".gitignore")
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces() // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}
java {
// don't need to set target, it is inferred from java
// apply a specific flavor of google-java-format
googleJavaFormat("1.17.0").reflowLongStrings()
// fix formatting of type annotations
formatAnnotations()
}
kotlinGradle {
target("*.gradle.kts") // default target for kotlinGradle
ktlint() // or ktfmt() or prettier()
}
}
jooq {
version.set("3.18.6") // default (can be omitted)
edition.set(nu.studer.gradle.jooq.JooqEdition.OSS) // default (can be omitted)
configurations {
create("main") { // name of the jOOQ configuration
generateSchemaSourceOnCompilation.set(false) // default (can be omitted)
jooqConfiguration.apply {
logging = Logging.WARN
jdbc.apply {
driver = "org.postgresql.Driver"
url = "jdbc:postgresql://${System.getenv("DATABASE_HOST_PORT")}/${System.getenv("DATABASE_DB")}"
user = System.getenv("DATABASE_USER")
password = System.getenv("DATABASE_PASSWORD")
}
generator.apply {
name = "org.jooq.codegen.DefaultGenerator"
database.apply {
name = "org.jooq.meta.postgres.PostgresDatabase"
inputSchema = "mjga"
forcedTypes.addAll(
listOf(
ForcedType().apply {
name = "varchar"
includeExpression = ".*"
includeTypes = "JSONB?"
},
ForcedType().apply {
name = "varchar"
includeExpression = ".*"
includeTypes = "INET"
},
),
)
}
generate.apply {
isDeprecated = false
isRecords = true
isImmutablePojos = false
isFluentSetters = true
isDaos = true
isSpringDao = true
isSpringAnnotations = true
}
target.apply {
packageName = "jooq"
directory = "build/generated-src/jooq/main" // default (can be omitted)
}
strategy.name = "org.jooq.codegen.DefaultGeneratorStrategy"
}
}
}
}
}