We are using jackson serialization of the ObjectMapper in Java.
For a LocalDateTime
, the code running in my local outputs the log below :
"date":"2019-11-28T18:56:00.328Z"
The same code running on jenkins produces sth else:
"date":{"offset":{"totalSeconds":0,"id":"Z","rules":{"fixedOffset":true,"transitions":[],"transitionRules":[]}},"zone":{"totalSeconds":0,"id":"Z","rules":{"fixedOffset":true,"transitions":[],"transitionRules":[]}},"dayOfWeek":"THURSDAY","dayOfYear":332,"hour":18,"minute":46,"second":55,"nano":948000000,"year":2019,"month":"NOVEMBER","dayOfMonth":28,"monthValue":11,"chronology":{"calendarType":"iso8601","id":"ISO"}}
In the app start up we do the following:
Json.mapper.findAndRegisterModules();
Json.mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
Json.mapper.configure(DeserializationFeature.READ_ENUMS_USING_TO_STRING, true);
Json.mapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS);
and the dependencies in the pom.xml are
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.6.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.4</version>
</dependency>
EDIT:
The jenkins machine has a different locale/timezone