Skip to content

Instantly share code, notes, and snippets.

@Eng-Fouad
Last active October 14, 2024 01:27
Show Gist options
  • Save Eng-Fouad/4ac43228e8602bd63cb141e72a4f4dbe to your computer and use it in GitHub Desktop.
Save Eng-Fouad/4ac43228e8602bd63cb141e72a4f4dbe to your computer and use it in GitHub Desktop.
Print buildTimestamp at startup using Quarkus and Gradle
# custom configurations
core.build-timestamp=@buildTimestamp@
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
}
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