Last active
October 14, 2024 01:27
-
-
Save Eng-Fouad/4ac43228e8602bd63cb141e72a4f4dbe to your computer and use it in GitHub Desktop.
Print buildTimestamp at startup using Quarkus and Gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# custom configurations | |
core.build-timestamp=@buildTimestamp@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.ZoneId | |
import java.time.ZonedDateTime | |
import java.time.format.DateTimeFormatter | |
tasks.named<ProcessResources>("processResources") { | |
filesMatching("application.properties") { | |
filter(org.apache.tools.ant.filters.ReplaceTokens::class, "tokens" to mapOf("buildTimestamp" to DateTimeFormatter.ISO_DATE_TIME.format( | |
ZonedDateTime.now(ZoneId.of("Asia/Riyadh"))))) | |
} | |
outputs.upToDateWhen { false } // disable caching | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.smallrye.config.ConfigMapping; | |
/** | |
* Core configuration properties. | |
* | |
* @author Fouad Almalki | |
*/ | |
@ConfigMapping(prefix = "core") | |
public interface CoreConfigs { | |
String buildTimestamp(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment