Add gradle9 module: Spring Boot 4 build migrated from Gradle 8 to Gradle 9
Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gth99spB1CzQmBFofXmU4Z
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
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() }
|
||||
Reference in New Issue
Block a user