Quantcast
Channel: How to access maven.build.timestamp for resource filtering - Stack Overflow
Viewing all articles
Browse latest Browse all 5

Answer by rogerdpack for How to access maven.build.timestamp for resource filtering

$
0
0

I can confirm as of Maven 3.x {maven.build.timestamp} is "working" now. They work arounded the problem, apparently. No additional properties workaround needed anymore.

However, be careful your "filtering" plugin (maven-resources-plugin) is up to date. It needs to be relatively new, so if mvn help:effective-pom shows an old version (ex: 2.6), bump it to something newer, fixed it for me, 3.x ex:

<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-resources-plugin</artifactId><version>3.1.0</version></plugin>

<properties><timestamp>... workaround is no longer required...

This also cleared up, kind of, why it was working in IntelliJ but not the command line. IntelliJ probably uses their own "modified/internal" maven constants, so it was working there, but not from maven command line.

Also note if you add a filtering resource directory to you pom, you may need to also "re-add" the default directory, it gets lost, ex:

<resource><directory>src/main/resources-filtered</directory> <!-- to get "maven.build.timestamp" into resource properties file --><filtering>true</filtering></resource><resource><directory>src/main/resources</directory> <!-- apparently have to add this is you have the other... --></resource>

NB if you're using spring boot as your parent, you have to use @maven.build.timestamp@ instead. Also note if you're using spring boot there's a file META-INF/build-info.properties that is optionally created by the spring-boot-maven-plugin that you can read (spring provides a BuildProperties bean for convenience reading it).


Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>