67 lines
No EOL
1.8 KiB
Kotlin
67 lines
No EOL
1.8 KiB
Kotlin
plugins {
|
|
java
|
|
id("io.spring.dependency-management") version "1.1.6"
|
|
id("org.openapi.generator") version "7.10.0"
|
|
idea
|
|
}
|
|
|
|
group = "org.springframework.samples"
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(21)
|
|
}
|
|
}
|
|
|
|
dependencyManagement {
|
|
imports {
|
|
mavenBom ("org.springframework.boot:spring-boot-dependencies:3.3.6")
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
implementation("org.springframework.boot:spring-boot-starter-web")
|
|
implementation("org.springframework.boot:spring-boot-starter-validation")
|
|
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0")
|
|
}
|
|
|
|
tasks.withType<JavaCompile> {
|
|
dependsOn(tasks.openApiGenerate)
|
|
}
|
|
|
|
java.sourceSets["main"].java {
|
|
srcDir(layout.buildDirectory.dir("generated/sources/openapi/src/main/java"))
|
|
}
|
|
|
|
openApiGenerate {
|
|
inputSpec.set("${projectDir}/src/main/resources/openapi.yml")
|
|
outputDir.set(layout.buildDirectory.dir("generated/sources/openapi").map { it.asFile.absolutePath })
|
|
generatorName.set("spring")
|
|
library.set("spring-boot")
|
|
modelNameSuffix.set("Dto")
|
|
apiPackage.set("org.springframework.samples.petclinic.rest.api")
|
|
modelPackage.set("org.springframework.samples.petclinic.rest.dto")
|
|
supportingFilesConstrainedTo.set(listOf("ApiUtil.java"))
|
|
globalProperties.set(
|
|
mapOf(
|
|
"apis" to "",
|
|
"models" to ""
|
|
)
|
|
)
|
|
configOptions.set(
|
|
mutableMapOf(
|
|
"verbose" to "true",
|
|
"interfaceOnly" to "true",
|
|
"performBeanValidation" to "true",
|
|
"dateLibrary" to "java8",
|
|
"useSpringBoot3" to "true",
|
|
"openApiNullable" to "false",
|
|
"serializationLibrary" to "jackson",
|
|
"documentationProvider" to "springdoc",
|
|
)
|
|
)
|
|
} |