Accessing the version and name of the application works fine. But I also want to access the build date/time of a Quarkus application using maven. I know, there is a post for this already but I don't get it to work for Quarkus.
I have an application.properties file with:
# info properties
quarkus.application.version=1.0
quarkus.application.timestamp=${maven.build.timestamp}
In pom.xml, resource filtering is activated:
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${version.resources-plugin}</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes/META-INF/resources/</outputDirectory>
<resources>
<resource>
<directory>name-frontend/dist/name-frontend</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
And in Java, accessing it via:
@ConfigProperty(name = "quarkus.application.version") // <--- works
String version;
@ConfigProperty(name = "quarkus.application.name") // <--- works
String name;
@ConfigProperty(name = "quarkus.application.timestamp") // <--- what to use here?
String buildDate;
Error:
Caused by: java.lang.RuntimeException: Failed to start quarkus
Caused by: java.util.NoSuchElementException: SRCFG00011: Could not expand value maven.build.timestamp in property quarkus.application.timestamp
Leaving the application.properties file without ${maven.build.timestamp} does let the build proceed, but there is simply no build time of course.