1

My requirement is very simple, I need time in format : yyyyMMdd-HHmm and timezone : EST

From this maven bug, I assume the timezone feature is available in maven : https://issues.apache.org/jira/browse/MNG-5452

Tried multiple options, and searched a lot to find some clues, but all efforts in vain.

Issue: I get time in yyyyMMdd-HHmm format, but always in GMT/UTC, as it's a default timezone. But I am wondering how I override it, any clues, please?

I am not supposed to set or change timezone in MVN_OPTIONS.

Below code didn't help:

    <properties>
        <java.version>11</java.version>
        <timestamp>${maven.build.timestamp}</timestamp>
        <maven.build.timestamp.format>yyyyMMdd-HHmm</maven.build.timestamp.format>
        <maven.build.timestamp.timezone>EST</maven.build.timestamp.timezone>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <id>timestamp-property</id>
                        <goals>
                            <goal>timestamp-property</goal>
                        </goals>
                        <configuration>
                            <name>timestamp</name>
                            <pattern>yyyy-MM-dd HH-mm-ss</pattern>
                            <locale>en_US</locale>
                            <timeZone>America/New_York</timeZone>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

Maven version:

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: C:\apache-maven-3.8.4
Java version: 11, vendor: Oracle Corporation, runtime: C:\java\jdk-11
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Molay
  • 1,154
  • 2
  • 19
  • 42

0 Answers0