Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gth99spB1CzQmBFofXmU4Z
36 lines
1.1 KiB
Kotlin
36 lines
1.1 KiB
Kotlin
plugins {
|
|
java
|
|
alias(libs.plugins.spring.boot)
|
|
alias(libs.plugins.dependency.management)
|
|
}
|
|
|
|
group = "com.ankurm"
|
|
version = "0.0.1"
|
|
|
|
tasks.withType<JavaCompile>().configureEach { options.release = 17 }
|
|
|
|
base { archivesName = "g9demo" }
|
|
|
|
repositories { mavenCentral() }
|
|
|
|
dependencies {
|
|
implementation(libs.starter.webmvc)
|
|
testImplementation(libs.starter.webmvc.test)
|
|
}
|
|
|
|
// Configuration-cache-safe: a typed task whose inputs are Property/Provider values,
|
|
// so nothing reaches back into the script or Project when the task executes.
|
|
abstract class BuildInfo : DefaultTask() {
|
|
@get:Input abstract val text: Property<String>
|
|
@get:OutputFile abstract val target: RegularFileProperty
|
|
@TaskAction fun write() { target.get().asFile.writeText(text.get()) }
|
|
}
|
|
|
|
tasks.register<BuildInfo>("buildInfo") {
|
|
val prefix = "${project.name} ${project.version} " // read at configuration time
|
|
text = providers.environmentVariable("BUILD_STAMP").orElse("local").map { "$prefix$it\n" }
|
|
target = layout.buildDirectory.file("build-info.txt")
|
|
}
|
|
|
|
tasks.named<Test>("test") { useJUnitPlatform() }
|