-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
134 lines (113 loc) · 4.09 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
129
130
131
132
133
134
buildscript {
repositories {
mavenCentral()
}
// dependencies {
// classpath 'org.springframework.cloud:spring-cloud-contract-gradle-plugin:2.2.3.RELEASE'
// }
}
plugins {
id 'org.springframework.boot' version '2.3.1.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'org.openapi.generator' version '4.3.1'
id "io.freefair.lombok" version "5.1.0"
id 'java'
id 'idea'
}
group = 'com.ilt'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/' }
}
ext {
set('springCloudVersion', "Hoxton.SR6")
set('springFoxVersion', "3.0.0")
}
//sourceSets{
// main {
// java {
// srcDirs = ['src/main/java', "$buildDir/generated/sources/annotationProcessor/java/main"]
// }
// }
//}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation "io.springfox:springfox-boot-starter:${springFoxVersion}"
compile 'javax.validation:validation-api:2.0.1.Final'
compile 'org.openapitools:jackson-databind-nullable:0.2.1'
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.11.0'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation 'io.projectreactor:reactor-test'
}
dependencyManagement {
}
test {
useJUnitPlatform()
}
def openapiSourceFile = "$rootDir/api/users-api.yaml"
def openapiTargetDir = "${buildDir}/generated"
task javaServerOpenApiGenerate(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
generatorName = "spring"
inputSpec = "${openapiSourceFile}".toString()
outputDir = "${openapiTargetDir}".toString()
apiPackage = "${rootProject.ext.javaPackageName}.rest.interfaces"
invokerPackage = "${rootProject.ext.javaPackageName}.rest"
modelPackage = "${rootProject.ext.javaPackageName}.model"
generateModelTests = false
generateApiTests = false
templateDir = "$rootDir/api/templates/JavaSpring"
configOptions = [
dateLibrary : "java8-localdatetime"
, hideGenerationTimestamp: "true"
// , configPackage: rootProject.ext.javaPackageName
// , sourceFolder : rootProject.ext.javaGeneratedDir
, java8 : "true"
, reactive : "true"
// , interfaceOnly : "true"
, useTags : "true"
, delegatePattern : "true"
]
}
task javaClientOpenApiGenerate(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
generatorName = "spring"
inputSpec = "$rootDir/api/openapi.yaml".toString()
outputDir = "$buildDir/generated".toString()
apiPackage = "${rootProject.ext.javaPackageName}.client.api"
invokerPackage = "${rootProject.ext.javaPackageName}.client"
modelPackage = "${rootProject.ext.javaPackageName}.model"
generateModelTests = false
generateApiTests = false
configOptions = [
dateLibrary : "java8-localdatetime"
, java8 : "true"
, library : "webclient"
, reactive : "true"
, sourceFolder: rootProject.ext.javaGeneratedDir
]
}
task customOpenApiGenerate(dependsOn: ['javaServerOpenApiGenerate'])
compileJava.dependsOn tasks.customOpenApiGenerate
compileJava.dependsOn tasks.openApiValidate
//sourceSets.main.java.srcDir new File(buildDir, "${openapiTargetDir}/src/main/java")
sourceSets.main.java.srcDir "${openapiTargetDir}/src/main/java"
sourceSets.main.resources.srcDir "${openapiTargetDir}/src/main/resources"
compileJava.dependsOn processResources
openApiValidate {
inputSpec = "$rootDir/api/openapi.yaml".toString()
recommend = true
}
bootJar {
mainClassName = 'com.ilt.api.ApiFirstApplication'
}
task allDeps(type: DependencyReportTask) {}