plugins { java id("org.springframework.boot") version "3.3.6" id("io.spring.dependency-management") version "1.1.6" idea jacoco } group = "org.springframework.samples" java { toolchain { languageVersion = JavaLanguageVersion.of(21) } } repositories { mavenCentral() } dependencies { implementation("org.springframework.boot:spring-boot-starter-actuator") implementation("org.springframework.boot:spring-boot-starter-cache") implementation("org.springframework.boot:spring-boot-starter-data-jpa") implementation("org.springframework.boot:spring-boot-starter-jdbc") implementation("org.springframework.boot:spring-boot-starter-security") implementation("org.springframework.boot:spring-boot-starter-validation") implementation("org.springframework.boot:spring-boot-starter-web") implementation("org.springframework.data:spring-data-jdbc-core:1.2.1.RELEASE") implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0") implementation("org.mapstruct:mapstruct:${project.property("mapstructVersion")}") implementation(project(":backend-model")) annotationProcessor("org.mapstruct:mapstruct-processor:${project.property("mapstructVersion")}") runtimeOnly("org.hsqldb:hsqldb") testImplementation("org.springframework.boot:spring-boot-starter-test") testImplementation("org.springframework.security:spring-security-test") testImplementation("com.jayway.jsonpath:json-path") testRuntimeOnly("org.junit.platform:junit-platform-launcher") } tasks.jacocoTestReport { dependsOn(tasks.test) // tests are required to run before generating the report classDirectories.setFrom( files(classDirectories.files.map { fileTree(it) { exclude( "**/org/springframework/samples/petclinic/rest/dto/**", "**/org/springframework/samples/petclinic/rest/api/**" ) } }) ) } tasks.jacocoTestCoverageVerification { violationRules { rule { element = "BUNDLE" limit { counter = "LINE" value = "COVEREDRATIO" minimum = "0.85".toBigDecimal() } limit { counter = "BRANCH" value = "COVEREDRATIO" minimum = "0.66".toBigDecimal() } } } } tasks.withType { useJUnitPlatform() finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run configure { } } tasks.withType { options.compilerArgs = listOf( "-Amapstruct.suppressGeneratorTimestamp=true", "-Amapstruct.suppressGeneratorVersionInfoComment=true", "-Amapstruct.defaultComponentModel=spring" ) }