plugins { kotlin("jvm") version "2.3.21" kotlin("plugin.spring") version "2.3.21" kotlin("plugin.jpa") version "2.3.21" id("org.springframework.boot") version "4.1.1" id("io.spring.dependency-management") version "1.1.7" id("org.openapi.generator") version "7.11.0" kotlin("kapt") version "2.3.21" } group = "at.fhtw.swen3" version = "0.0.2-SNAPSHOT" java { toolchain { languageVersion.set(JavaLanguageVersion.of(25)) } } repositories { mavenCentral() } dependencies { implementation("org.springframework.boot:spring-boot-h2console") implementation("org.springframework.boot:spring-boot-starter-data-jpa") implementation("org.springframework.boot:spring-boot-starter-flyway") implementation("org.springframework.boot:spring-boot-starter-security") implementation("org.springframework.boot:spring-boot-starter-oauth2-resource-server") implementation("org.springframework.boot:spring-boot-starter-validation") implementation("org.springframework.boot:spring-boot-starter-webmvc") implementation("org.jetbrains.kotlin:kotlin-reflect") implementation("org.jetbrains.kotlin:kotlin-stdlib") implementation("tools.jackson.module:jackson-module-kotlin") implementation("org.mapstruct:mapstruct:1.6.3") implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:3.1.1") implementation("org.openapitools:jackson-databind-nullable:0.2.6") developmentOnly("org.springframework.boot:spring-boot-devtools") runtimeOnly("com.h2database:h2") runtimeOnly("org.flywaydb:flyway-database-postgresql") runtimeOnly("org.postgresql:postgresql") kapt("org.springframework.boot:spring-boot-configuration-processor") kapt("org.mapstruct:mapstruct-processor:1.6.3") testImplementation("org.springframework.boot:spring-boot-starter-data-jpa-test") testImplementation("org.springframework.boot:spring-boot-starter-security-test") testImplementation("org.springframework.boot:spring-boot-starter-validation-test") testImplementation("org.springframework.boot:spring-boot-starter-webmvc-test") testImplementation("org.jetbrains.kotlin:kotlin-test-junit5") testImplementation(kotlin("test")) } kotlin { compilerOptions { freeCompilerArgs.addAll("-Xjsr305=strict", "-Xannotation-default-target=param-property") } sourceSets { main { kotlin.srcDir(layout.buildDirectory.dir("generated/openapi/src/main/kotlin")) } } } allOpen { annotation("jakarta.persistence.Entity") annotation("jakarta.persistence.MappedSuperclass") annotation("jakarta.persistence.Embeddable") } openApiGenerate { generatorName.set("kotlin-spring") inputSpec.set("$projectDir/src/main/resources/openapi.yaml") outputDir.set(layout.buildDirectory.dir("generated/openapi").get().asFile.path) apiPackage.set("at.fhtw.swen3.paperless.api") modelPackage.set("at.fhtw.swen3.paperless.dto") configOptions.set( mapOf( "interfaceOnly" to "true", "useSpringBoot3" to "true", "useBeanValidation" to "true", "enumPropertyNaming" to "UPPERCASE", "openApiNullable" to "false", "useTags" to "true" ) ) } tasks.named("compileKotlin") { dependsOn("openApiGenerate") } tasks.matching { it.name == "kaptGenerateStubsKotlin" }.configureEach { dependsOn("openApiGenerate") } tasks.withType { useJUnitPlatform() }