build-helper-maven-plugin icon indicating copy to clipboard operation
build-helper-maven-plugin copied to clipboard

Need option to use current time zone in generating timestamp.

Open garretwilson opened this issue 6 years ago • 4 comments

If I'm doing a Maven build, I want to generate a property using the timestamp-property in the format yyyy-MM-dd, but I want it to reflect the current time zone of the machine doing the build. (Thus I want it equivalent to a LocalDate saying what date the build was performed on; the time zone is irrelevant.)

But currently the timeZone defaults to GMT. Instead, the timeZone should default to the current JVM time zone to reflect the time zone of the build. If the developer wants to use GMT, they can specify that in the timeZone value.

As it stands, there is no way for the developer to indicate that the timestamp should be determined based upon the current JVM time zone.

garretwilson avatar Mar 03 '19 00:03 garretwilson

Or is the documentation incorrect when it indicates that the default value is GMT? And I don't know what issue #61 is talking about when it refers to a timeSource.

garretwilson avatar Mar 03 '19 00:03 garretwilson

Can we reopen this? I don't see that this was ever addressed. Let's say that I have this:

<execution>
  <id>set-build-date</id>
  <goals>
    <goal>timestamp-property</goal>
  </goals>
  <configuration>
    <locale>en</locale>
    <timeSource>build</timeSource>
    <timeZone>UTC</timeZone>
    <name>build.date</name>
    <pattern>yyyy-MM-dd</pattern>
  </configuration>
</execution>

I want this to show the date the build was started. But if I'm sitting in Miami, Florida working late on 2021-02-03, it's already 2021-02-04 in UTC. (That's just one example.) I want the build date to indicate 2021-02-03; thus timeZone should default to the current JVM time zone if I don't specify anything.

The need here is different based upon the pattern. If I want a full timestamp, then yes I would want UTC. (I don't think I would every want GMT, which is effectively obsolete.)

garretwilson avatar Oct 26 '22 21:10 garretwilson

I notice that all these issues that I have posted keep getting closed by the bot repeatedly over the years, with no sign that any human has looked into them.

Could I ask if this project is still active?

garretwilson avatar Nov 04 '23 02:11 garretwilson

Hi, yes this project is active and volunteers do pr review

slachiewicz avatar Nov 04 '23 07:11 slachiewicz