plugins {
    id 'java-library'
    id 'io.spring.dependency-management'
    id 'io.arconia.optional-dependencies'
    id 'org.graalvm.buildtools.native'
}

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}

repositories {
    mavenCentral()
}

dependencyManagement {
    imports {
        mavenBom org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES
    }
}

configurations.configureEach {
    resolutionStrategy.dependencySubstitution {
        // Override transitive dependency from Testcontainers to fix CVE-2024-26308 and CVE-2024-25710
        substitute module('org.apache.commons:commons-compress') using module('org.apache.commons:commons-compress:1.28.0')
        // Override transitive dependency from Commons Compress to fix CVE-2025-48924
        substitute module('org.apache.commons:commons-lang3') using module('org.apache.commons:commons-lang3:3.18.0')
    }
}

tasks.withType(JavaCompile).configureEach {
    options.compilerArgs.add("-parameters")
}

tasks.named('test') {
    useJUnitPlatform()
}
