Last active
February 4, 2022 05:51
-
-
Save gregopet/d11fe8b23e82082f990ea636db04f6ca to your computer and use it in GitHub Desktop.
More recent & simpler version of jooq.gradle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jooq.codegen.GenerationTool | |
// To include into main Gradle file, use: apply(from = "jooq.gradle.kts") | |
val dbHost: String by project | |
val dbPort: String by project | |
val dbName: String by project | |
val dbUser: String by project | |
val dbPass: String by project | |
val config = """ | |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.13.0.xsd"> | |
<jdbc> | |
<driver>org.postgresql.Driver</driver> | |
<url>jdbc:postgresql://$dbHost:$dbPort/$dbName</url> | |
<user>$dbUser</user> | |
<password>$dbPass</password> | |
</jdbc> | |
<generator> | |
<!-- my config goes here --> | |
</generator> | |
</configuration> | |
""".trimIndent() | |
buildscript { | |
val jooqVersion: String by project | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath("org.jooq:jooq:$jooqVersion") | |
classpath("org.jooq:jooq-meta:$jooqVersion") | |
classpath("org.jooq:jooq-codegen:$jooqVersion") | |
} | |
} | |
tasks.create(name = "jooqModel") { | |
group = "Build" | |
description = "Generates the jOOQ model from the local database" | |
doLast { | |
GenerationTool.generate(config) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment