3

We are running Jenkins on server with UTC but our office is located at Berlin. Thus we configured -Dorg.apache.commons.jelly.tags.fmt.timeZone=Europe/Berlin to have the UI in CE(S)T.

But how to ensure Maven Java builds to run with default TimeZone Europe/Berlin?

We tried to add -Duser.timezone=Europe/Berlinto the Jenkins scipt and to Global MAVEN_OPTS.

But TimeZone.getDefault() (in jUnit tests) results in sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null].

André
  • 308
  • 2
  • 17
  • 3
    Did you see this thread : https://stackoverflow.com/questions/23466218/setting-timezone-for-maven-unit-tests-on-java-8 – jaudo Jan 21 '19 at 15:05
  • 2
    Yes, adding `-Duser.timezone=Europe/Berlin` works as desired. But I prefer configuring Jenkins than modifying the code. – André Jan 21 '19 at 16:22
  • You should use late replacement to set surefire argLine from Jenkins: https://maven.apache.org/surefire/maven-surefire-plugin/faq.html#late-property-evaluation See this thread : https://stackoverflow.com/questions/46489455/append-the-value-of-argline-param-in-maven-surefire-plugin/46490011 – jaudo Jan 21 '19 at 16:32

0 Answers0