File tree Expand file tree Collapse file tree 4 files changed +21
-24
lines changed
Expand file tree Collapse file tree 4 files changed +21
-24
lines changed Original file line number Diff line number Diff line change 1- import org.gradle.api.tasks.bundling.Jar
21import org.springframework.boot.gradle.tasks.bundling.BootJar
32
43val jar: Jar by tasks
Original file line number Diff line number Diff line change 1+ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+ import org.springframework.boot.gradle.tasks.bundling.BootJar
3+
14plugins {
25 java
36 kotlin(" jvm" ) version " 1.9.24" apply false
@@ -12,27 +15,40 @@ subprojects {
1215 apply (plugin = " org.springframework.boot" )
1316 apply (plugin = " io.spring.dependency-management" )
1417
18+ configureStandardJarTasks()
19+ configureKotlinCompile()
20+
1521 group = " io.github.gunkim.realworld"
1622 version = " 0.0.1"
1723
1824 repositories {
1925 mavenCentral()
2026 }
21-
2227 dependencies {
2328 implementation(" io.github.oshai:kotlin-logging-jvm:7.0.3" )
2429 testRuntimeOnly(" org.junit.platform:junit-platform-launcher" )
2530 testImplementation(" io.kotest:kotest-runner-junit5:5.9.1" )
2631 }
2732
28- tasks.withType< org.jetbrains.kotlin.gradle.tasks.KotlinCompile > {
33+ tasks.withType<Test > {
34+ useJUnitPlatform()
35+ }
36+ }
37+
38+ fun Project.configureKotlinCompile () {
39+ tasks.withType<KotlinCompile > {
2940 kotlinOptions {
3041 freeCompilerArgs + = " -Xjsr305=strict"
3142 jvmTarget = " 21"
3243 }
3344 }
45+ }
3446
35- tasks.withType<Test > {
36- useJUnitPlatform()
47+ fun Project.configureStandardJarTasks () {
48+ tasks.named<Jar >(" jar" ) {
49+ enabled = true
50+ }
51+ tasks.named<BootJar >(" bootJar" ) {
52+ enabled = false
3753 }
38- }
54+ }
Original file line number Diff line number Diff line change 1- import org.gradle.api.tasks.bundling.Jar
2- import org.springframework.boot.gradle.tasks.bundling.BootJar
3-
4- val jar: Jar by tasks
5- val bootJar: BootJar by tasks
6-
7- bootJar.enabled = false
8- jar.enabled = true
9-
101plugins {
112 kotlin(" plugin.spring" )
123 kotlin(" plugin.jpa" )
Original file line number Diff line number Diff line change 1- import org.gradle.api.tasks.bundling.Jar
2- import org.springframework.boot.gradle.tasks.bundling.BootJar
3-
4- val jar: Jar by tasks
5- val bootJar: BootJar by tasks
6-
7- bootJar.enabled = false
8- jar.enabled = true
9-
101dependencies {
112 implementation(" org.springframework.boot:spring-boot-starter" )
123}
You can’t perform that action at this time.
0 commit comments