Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jackson JavaTimeModule not found even after adding jackson-modules-java8 dependency? [duplicate]

NOT A DUPLICATE -- I'm trying to follow the solutions given in Is there a jackson datatype module for JDK8 java.time? (it is the cause of this question, not a duplicate).

I added

<dependency>
    <groupId>com.fasterxml.jackson.module</groupId>
    <artifactId>jackson-modules-java8</artifactId>
    <version>2.9.5</version>
    <type>pom</type>
</dependency>

But I'm still not able to do this:

ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JavaTimeModule());

The JavaTimeModule class is nowhere to be found. What am I doing wrong?

like image 401
Alex R Avatar asked Apr 30 '18 22:04

Alex R


1 Answers

Use the following dependency:

<dependency>
    <groupId>com.fasterxml.jackson.datatype</groupId>
    <artifactId>jackson-datatype-jsr310</artifactId>
    <version>2.9.5</version>
</dependency>

Then you'll be able to register the JavaTimeModule class. See the documentation for details.

like image 136
cassiomolin Avatar answered Oct 12 '22 22:10

cassiomolin