-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathbuild.gradle
58 lines (53 loc) · 1.6 KB
/
build.gradle
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
import java.util.concurrent.atomic.AtomicReference
plugins {
id 'nu.studer.jooq' version '9.0'
id 'java'
}
repositories {
mavenCentral()
}
dependencies {
jooqGenerator 'com.h2database:h2:2.1.214'
}
jooq {
configurations {
main {
generationTool {
logging = org.jooq.meta.jaxb.Logging.INFO
jdbc {
driver = 'org.h2.Driver'
url = 'jdbc:h2:~/test;AUTO_SERVER=TRUE'
user = 'sa'
password = ''
}
generator {
name = 'org.jooq.codegen.DefaultGenerator'
database {
name = 'org.jooq.meta.h2.H2Database'
includes = '.*'
excludes = ''
}
target {
packageName = 'nu.studer.sample'
}
}
}
}
}
}
tasks.named('generateJooq').configure {
// customize execution of the code generation tool (only show output if code generation failed)
AtomicReference<OutputStream> outRef = new AtomicReference()
javaExecSpec = { JavaExecSpec s ->
outRef.set(new ByteArrayOutputStream())
s.standardOutput = outRef.get()
s.errorOutput = outRef.get()
s.ignoreExitValue = true
}
execResultHandler = { ExecResult r ->
def out = outRef.getAndSet(null)
if (r.exitValue != 0) {
throw new RuntimeException('jOOQ source code generation failed:\n\n' + out.toString())
}
}
}