plugins { java alias(libs.plugins.spring.boot) alias(libs.plugins.dependency.management) } group = "com.ankurm" version = "0.0.1" tasks.withType().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 @get:OutputFile abstract val target: RegularFileProperty @TaskAction fun write() { target.get().asFile.writeText(text.get()) } } tasks.register("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") { useJUnitPlatform() }