-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
128 lines (111 loc) · 4.02 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
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
plugins {
id 'org.springframework.boot' version '2.1.4.RELEASE'
id 'java'
id 'idea'
id 'nu.studer.jooq' version '3.0.3'
id "org.flywaydb.flyway" version "5.2.4"
}
apply plugin: 'io.spring.dependency-management'
group = 'ru.hixon.microservice'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
def databaseLogin = 'postgres'
def databasePassword = 'password'
def databaseUrl = 'jdbc:postgresql://localhost:5432/microservice'
def generatedDir = 'src/generated/jooq'
flyway {
url = databaseUrl
user = databaseLogin
password = databasePassword
}
jooq {
microservice(sourceSets.main) {
jdbc {
driver = 'org.postgresql.Driver'
url = databaseUrl
user = databaseLogin
password = databasePassword
}
generator {
name = 'org.jooq.codegen.DefaultGenerator'
strategy {
name = 'org.jooq.codegen.DefaultGeneratorStrategy'
}
database {
name = 'org.jooq.meta.postgres.PostgresDatabase'
inputSchema = 'public'
}
generate {
relations = true
deprecated = false
records = true
immutablePojos = true
fluentSetters = true
}
target {
packageName = 'ru.hixon.microservice'
directory = generatedDir
}
}
}
}
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(test) || graph.hasTask(bootRun)) {
generateMicroserviceJooqSchemaSource.enabled = false
}
}
//clean.doLast {
// project.file(generatedDir).deleteDir()
//}
sourceSets {
main {
java {
srcDirs += "src/main/java"
srcDirs += generatedDir
}
resources {
srcDirs += "src/main/resources"
}
}
test {
java {
srcDirs += "src/test/java"
}
resources {
srcDirs += "src/test/resources"
}
}
}
generateMicroserviceJooqSchemaSource.dependsOn(clean)
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-jooq'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.flywaydb:flyway-core'
runtimeOnly 'org.postgresql:postgresql'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
// https://mvnrepository.com/artifact/org.postgresql/postgresql
compile group: 'org.postgresql', name: 'postgresql', version: '42.2.5'
// https://mvnrepository.com/artifact/org.postgresql/postgresql
jooqRuntime group: 'org.postgresql', name: 'postgresql', version: '42.2.5'
implementation enforcedPlatform('io.zonky.test.postgres:embedded-postgres-binaries-bom:11.1.0')
// https://mvnrepository.com/artifact/io.zonky.test/embedded-database-spring-test
compile group: 'io.zonky.test', name: 'embedded-database-spring-test', version: '1.4.1'
// https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-api
compile group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.10.6'
// https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-impl
runtime group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.10.6'
// https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-jackson
runtime group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.10.6'
// https://mvnrepository.com/artifact/io.springfox/springfox-swagger2
compile group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.2'
// https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2'
// tmp
compile group: 'org.modelmapper', name: 'modelmapper', version: '2.3.3'
}