Skip to content

Commit ea3c42a

Browse files
committed
Add JOOQ code generation
1 parent 00da796 commit ea3c42a

File tree

2 files changed

+45
-8
lines changed

2 files changed

+45
-8
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ bin/
3737

3838
### Mac OS ###
3939
.DS_Store
40+
41+
### JOOQ ###
42+
src/generated/

build.gradle.kts

+42-8
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,61 @@
1+
import nu.studer.gradle.jooq.JooqEdition
2+
13
plugins {
24
kotlin("jvm") version "1.8.0"
35
application
4-
}
56

6-
group = "org.example"
7-
version = "1.0-SNAPSHOT"
7+
id("nu.studer.jooq") version "8.1"
8+
}
89

910
repositories {
1011
mavenCentral()
1112
}
1213

1314
dependencies {
1415
testImplementation(kotlin("test"))
16+
17+
implementation("org.postgresql:postgresql:42.2.27")
18+
implementation("org.jooq:jooq:3.17.6")
19+
jooqGenerator("org.postgresql:postgresql:42.2.27")
1520
}
1621

1722
tasks.test {
1823
useJUnitPlatform()
1924
}
2025

21-
kotlin {
22-
jvmToolchain(8)
23-
}
24-
2526
application {
2627
mainClass.set("MainKt")
27-
}
28+
}
29+
30+
jooq {
31+
version.set("3.17.6")
32+
edition.set(JooqEdition.OSS)
33+
34+
configurations {
35+
create("main") {
36+
jooqConfiguration.apply {
37+
logging = org.jooq.meta.jaxb.Logging.DEBUG
38+
39+
jdbc.apply {
40+
driver = "org.postgresql.Driver"
41+
url = "jdbc:postgresql://localhost:5432/byos"
42+
user = "postgres"
43+
password = ""
44+
}
45+
generator.apply {
46+
name = "org.jooq.codegen.JavaGenerator"
47+
database.apply {
48+
name = "org.jooq.meta.postgres.PostgresDatabase"
49+
inputSchema = "public"
50+
includes = ".*"
51+
excludes = ""
52+
}
53+
target.apply {
54+
packageName = "db.jooq.generated"
55+
directory = "${project.projectDir}/src/generated/java/jooq"
56+
}
57+
}
58+
}
59+
}
60+
}
61+
}

0 commit comments

Comments
 (0)