11import io.github.gradlenexus.publishplugin.NexusRepository
2- import org.gradle.api.JavaVersion.VERSION_1_8
3- import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+ import org.gradle.kotlin.dsl.*
43
54plugins {
65 kotlin(" jvm" ) version " 2.1.21"
@@ -20,31 +19,36 @@ repositories {
2019}
2120
2221dependencies {
23- testImplementation(name = " atrium-cc-en_GB-robstoll" , group = " ch.tutteli.atrium " , version = " 0.15.0" )
24- testImplementation(name = " junit-jupiter-api " , group = " org.junit.jupiter" , version = " 5.7.2" )
25- testImplementation(name = " junit-jupiter-params " , group = " org.junit.jupiter" , version = " 5.7.2" )
22+ testImplementation(" ch.tutteli. atrium:atrium -cc-en_GB-robstoll: 0.15.0" )
23+ testImplementation(" org.junit.jupiter:junit-jupiter-api: 5.7.2" )
24+ testImplementation(" org.junit.jupiter:junit-jupiter-params: 5.7.2" )
2625
2726 constraints {
2827 testImplementation(kotlin(" reflect" , KotlinVersion .CURRENT .toString()))
2928 }
3029
31- testRuntimeOnly(name = " junit-platform-launcher " , group = " org.junit.platform" , version = " 1.12.1" )
32- testRuntimeOnly(name = " junit-jupiter-engine " , group = " org.junit.jupiter" , version = " 5.7.2" )
30+ testRuntimeOnly(" org.junit.platform:junit-platform-launcher: 1.12.1" )
31+ testRuntimeOnly(" org.junit.jupiter:junit-jupiter-engine: 5.7.2" )
3332}
3433
35- tasks.withType<Test >().configureEach {
36- useJUnitPlatform()
37- reports.junitXml.required = true
38- }
34+ val compilationTargetJavaVersion = JavaLanguageVersion .of(8 )
3935
4036java {
41- sourceCompatibility = VERSION_1_8
42- targetCompatibility = VERSION_1_8
37+ toolchain {
38+ languageVersion = compilationTargetJavaVersion
39+ }
4340}
4441
45- kotlin {
46- compilerOptions {
47- jvmTarget = JvmTarget .JVM_1_8
42+ val testTargetJavaVersion = providers
43+ .gradleProperty(" testTargetJavaVersion" )
44+ .map(JavaLanguageVersion ::of)
45+ .orElse(compilationTargetJavaVersion)
46+
47+ tasks.withType<Test >().configureEach {
48+ useJUnitPlatform()
49+ reports.junitXml.required = true
50+ javaLauncher = javaToolchains.launcherFor {
51+ languageVersion = testTargetJavaVersion
4852 }
4953}
5054
@@ -78,11 +82,6 @@ val dokkaJar by tasks.registering(Jar::class) {
7882 from(tasks.named(" dokkaGeneratePublicationJavadoc" ))
7983}
8084
81- artifacts {
82- archives(sourcesJar)
83- archives(dokkaJar)
84- }
85-
8685lateinit var publication: MavenPublication
8786lateinit var githubPackages: ArtifactRepository
8887lateinit var mavenCentral: NexusRepository
0 commit comments