ProjectManagmentTool/build.gradle.kts

96 lines
2.7 KiB
Text
Raw Normal View History

2024-09-12 22:01:00 +00:00
import org.hidetake.gradle.swagger.generator.GenerateSwaggerCode
repositories {
mavenCentral()
}
plugins {
java
2024-09-12 22:23:47 +00:00
checkstyle
2024-09-12 22:01:00 +00:00
id("org.springframework.boot") version "3.3.3"
id("io.spring.dependency-management") version "1.1.6"
id("org.hidetake.swagger.generator") version "2.19.2"
}
2024-09-12 22:23:47 +00:00
checkstyle {
toolVersion = "10.12.4"
configFile = file("src/main/resources/checkstyle.xml")
}
2024-09-12 22:01:00 +00:00
group = "de.hmmh"
version = "0.0.1-SNAPSHOT"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
2024-09-12 22:01:00 +00:00
}
}
configurations {
compileOnly {
extendsFrom(configurations.annotationProcessor.get())
}
}
dependencies {
//Spring
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-web")
runtimeOnly("org.postgresql:postgresql")
//Lombok
compileOnly("org.projectlombok:lombok")
annotationProcessor("org.projectlombok:lombok")
//Test
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.boot:spring-boot-testcontainers")
testImplementation("org.testcontainers:junit-jupiter")
testImplementation("org.testcontainers:postgresql")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
//OAS
swaggerCodegen("org.openapitools:openapi-generator-cli:7.8.0")
implementation("io.swagger.core.v3:swagger-annotations:2.2.22")
}
swaggerSources {
register("pmt") {
setInputFile(file("${rootDir}/src/main/resources/api.yml"))
code.configFile = file("${rootDir}/src/main/resources/gen-config.json")
val validationTask = validation
code(delegateClosureOf<GenerateSwaggerCode> {
language = "spring"
components = listOf("models", "apis", "supportingFiles=ApiUtil.java")
code.rawOptions = listOf("--ignore-file-override=" + file("${rootDir}/src/main/resources/.codegen-ignore").absolutePath)
dependsOn(validationTask)
})
}
}
tasks {
processResources {
dependsOn(generateSwaggerCode)
}
withType<Test> {
useJUnitPlatform()
}
named("compileJava").configure {
dependsOn(swaggerSources.getByName("pmt").code)
}
2024-09-12 22:23:47 +00:00
withType<Checkstyle> {
reports {
xml.required.set(true)
html.required.set(false)
}
}
2024-09-12 22:01:00 +00:00
}
sourceSets {
main {
java.srcDir("${swaggerSources.getByName("pmt").code.outputDir}/src/main/java")
resources.srcDir("${swaggerSources.getByName("pmt").code.outputDir}/src/main/resources")
}
}