11import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+ import org.jetbrains.kotlin.gradle.plugin.KotlinBasePluginWrapper
3+ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
24import java.time.Duration
35
46plugins {
5- kotlin(" jvm" ) version " 2.1.10"
6- id(" signing" )
7- id(" maven-publish" )
7+ id(" java" )
8+ id(" org.jetbrains.kotlin.jvm" ) version " 2.1.10"
89 id(" org.jlleitschuh.gradle.ktlint" ) version " 12.1.2"
910 id(" io.github.gradle-nexus.publish-plugin" ) version " 2.0.0"
1011}
1112
12- group = " com.expediagroup.sdk"
13- version = " 1.0.0-SNAPSHOT"
13+ group = project.property(" GROUP_ID" ) as String
1414
15- repositories {
16- mavenCentral()
17- gradlePluginPortal()
18- maven {
19- url = uri(" https://oss.sonatype.org/content/repositories/snapshots/" )
15+ apply (" gradle-tasks/specs.gradle.kts" )
16+
17+ allprojects {
18+ repositories {
19+ mavenCentral()
20+ maven {
21+ url = uri(" https://oss.sonatype.org/content/repositories/snapshots/" )
22+ }
2023 }
2124}
2225
2326subprojects {
24- apply (plugin = " signing" )
25- apply (plugin = " maven-publish" )
26- apply (plugin = " org.jlleitschuh.gradle.ktlint" )
27+ apply (plugin = " java" )
2728 apply (plugin = " org.jetbrains.kotlin.jvm" )
29+ apply (plugin = " org.jlleitschuh.gradle.ktlint" )
2830
29- repositories {
30- mavenCentral()
31- gradlePluginPortal()
32- maven {
33- url = uri(" https://oss.sonatype.org/content/repositories/snapshots/" )
31+ plugins.withId(" org.jetbrains.kotlin.jvm" ) {
32+ kotlin {
33+ jvmToolchain(8 )
3434 }
3535 }
3636
37- kotlin {
38- jvmToolchain(21 )
39- target {
37+ plugins.withType<KotlinBasePluginWrapper >().configureEach {
38+ tasks.withType<KotlinCompile >().configureEach {
4039 compilerOptions {
41- jvmTarget = JvmTarget .JVM_1_8
40+ jvmTarget.set( JvmTarget .JVM_1_8 )
4241 }
4342 }
4443 }
4544
4645 java {
46+ withSourcesJar()
47+ withJavadocJar()
48+
4749 sourceCompatibility = JavaVersion .VERSION_1_8
4850 targetCompatibility = JavaVersion .VERSION_1_8
51+
52+ // Gradle 7+ Java toolchain approach (also sets 1.8)
53+ toolchain {
54+ languageVersion.set(JavaLanguageVersion .of(8 ))
55+ }
56+ }
57+
58+ ktlint {
59+ debug.set(true )
60+ version.set(" 1.5.0" )
61+ verbose.set(true )
62+
63+ additionalEditorconfig.set(
64+ mapOf (
65+ " max_line_length" to " 200" ,
66+ " indent_style" to " space" ,
67+ " indent_size" to " 4" ,
68+ " insert_final_newline" to " true" ,
69+ " end_of_line" to " lf" ,
70+ ),
71+ )
4972 }
5073}
5174
@@ -62,9 +85,3 @@ nexusPublishing {
6285 delayBetween.set(Duration .ofMillis(5000 ))
6386 }
6487}
65-
66- kotlin {
67- jvmToolchain(21 )
68- }
69-
70- apply (" gradle-tasks/specs.gradle.kts" )
0 commit comments