Gradle import com.fasterxml.jackson.datatype cannot be resolved

361
December 24, 2017, at 5:50 PM

import com.fasterxml.jackson.datatype cannot be resolved

As the screen shot shows, import com.fasterxml.jackson.datatype cannot be resolved.

I have imported jackson-datatype-jsr310', version: '2.9.3 in the build.gradle like this,

buildscript {
    ext {
        springBootVersion = '1.5.9.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
group = 'com.linkedin.learning'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
    mavenCentral()
}
dependencies {
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-web')
    runtime('com.h2database:h2')
    testCompile('org.springframework.boot:spring-boot-starter-test')
    // https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jsr310
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.9.3'

}

The last a few lines are from the Maven Repo: https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.9.3

What I am trying to use is the

com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;

However, even the com.fasterxml.jackson.datatype cannot be imported properly.

To solve this problem, I tried to add more dependencies in build.gradle, as this post suggests

Jackson cannot access com.fasterxml.jackson.core.ObjectCodec

buildscript {
    ext {
        springBootVersion = '1.5.9.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
group = 'com.linkedin.learning'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
    mavenCentral()
}
dependencies {
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-web')
    runtime('com.h2database:h2')
    testCompile('org.springframework.boot:spring-boot-starter-test')
    // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.9.3'

    // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.9.3'
    // https://mvnrepository.com/artifact/com.fasterxml.jackson.module/jackson-module-parameter-names
compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-parameter-names', version: '2.9.3'
    // https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jdk8
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jdk8', version: '2.9.3'
    // https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jsr310
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.9.3'
}

But it is still not imported.

The IDE I am using is Spring Tool Suite, and it is a web application

Thanks!

EDIT:

I understand that jackson-datatype-jsr310 is DEPRECATED and has become part of Jackson Java 8 Modules as of Jackson 2.8.5.

https://github.com/FasterXML/jackson-datatype-jsr310

However, I add this to the end of build.gradle,

    // https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jdk8
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jdk8', version: '2.9.3'

And import this

import com.fasterxml.jackson.datatype.jdk8;

It still shows import com.fasterxml.jackson.datatype cannot be resolved.

enter image description here

READ ALSO
How to return to main menu when user click Letter “M”?

How to return to main menu when user click Letter “M”?

How to return to main menu upon user enter letter "M"It would direct them to main menu page?

170
how to declare an interface inside non static inner class

how to declare an interface inside non static inner class

I'm working to improve an android recycler view by following this simple tutorialI found a java issue: if I declare an interface inside a non static view holder innerclass like below

192
Infinite scrolling background on libgdx

Infinite scrolling background on libgdx

I am trying to do an infinite scrolling background on libgdxThe image is scrolling fine in the X-axis, but in the Y-axis the image is split in half like shown in the picture below

356
Mobile App Crashes on Phone Lower than Android 6.0 during runtime Permission grant

Mobile App Crashes on Phone Lower than Android 6.0 during runtime Permission grant

I have been trying to solve this problem to allowing android versions that are MashMellows are higher to request permission for storage, camera, location and a fewThe permission request works on Android version higher than or equals of Android M (6

135