plugins { kotlin("jvm") version "2.1.21" apply false kotlin("plugin.spring") version "2.1.21" apply false id("org.springframework.boot") version "3.2.3" apply false id("io.spring.dependency-management") version "1.1.4" apply false base } allprojects { group = "at.mocode.meldestelle" version = "0.1.0-SNAPSHOT" } subprojects { repositories { mavenCentral() } // Enable dependency locking for all configurations dependencyLocking { lockAllConfigurations() } // Add task to write lock files tasks.register("resolveAndLockAll") { doFirst { require(gradle.startParameter.isWriteDependencyLocks) } doLast { configurations.filter { // Only lock configurations that can be resolved it.isCanBeResolved }.forEach { it.resolve() } } } // Configure Kotlin compiler options tasks.withType().configureEach { compilerOptions { jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21) freeCompilerArgs.add("-Xjsr305=strict") } } // Configure parallel test execution tasks.withType().configureEach { useJUnitPlatform() // Enable parallel test execution maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1 // Optimize JVM args for tests jvmArgs = listOf("-Xmx512m", "-XX:+UseG1GC") } // Define a custom integrationTest task tasks.register("integrationTest") { description = "Runs integration tests." group = "verification" // Use the same configuration as the test task useJUnitPlatform() maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1 jvmArgs = listOf("-Xmx512m", "-XX:+UseG1GC") // Include all tests that have "Integration" in their name include("**/*Integration*Test.kt") // Exclude unit tests (but keep integration tests) exclude("**/*Test.kt") include("**/*IntegrationTest.kt") // Set system properties for integration tests systemProperty("spring.profiles.active", "integration-test") systemProperty("redis.host", "localhost") systemProperty("redis.port", "6379") // Generate reports in a separate directory reports { html.required.set(true) junitXml.required.set(true) } // This task should run after the regular test task // We don't use mustRunAfter here to avoid reference issues } } // Wrapper task configuration for the root project tasks.wrapper { gradleVersion = "8.14" distributionType = Wrapper.DistributionType.BIN }