In Maven 3.2.2+, the maven.build.timestamp
has been redefined to show the time in UTC, as per MNG-5452.
Is there any way to specify that I want the timezone info in my local timezone and not in UTC? I briefly browsed the maven sources, but do not see anyway to specify that I want the TZ to be local TZ and not UTC based.
This plugin is designed to give you a build number. So when you might make 100 builds of version 1.0-SNAPSHOT, you can differentiate between them all.
What is a POM? A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details used by Maven to build the project. It contains default values for most projects.
As already mentioned, in the current versions of Maven (at least up to version 3.3.+), the maven.build.timestamp
property does not allow for timezone overrides.
However, if you are okay with utilizing a different property name for your purposes, the build-helper-maven-plugin allows you to configure custom timestamps for a variety of purposes. Here is an example to configure the current timestamp in EST during a build.
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.10</version> <executions> <execution> <id>timestamp-property</id> <goals> <goal>timestamp-property</goal> </goals> <configuration> <name>build.time</name> <pattern>MM/dd/yyyy hh:mm aa</pattern> <locale>en_US</locale> <timeZone>America/Detroit</timeZone> </configuration> </execution> </executions> </plugin>
Then you can utilize the ${build.time}
property instead of ${maven.build.timestamp}
where you need a timestamp of the build in your preferred timezone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With