Sushant Bajracharya Sushant Bajracharya - 2 months ago 12
Java Question

Err when importing a dependency

I am coming from a ruby programming background and I have started learning java. I absolutely fell in love with it. Right now I am trying to run the sample aws iot java sdk project but I keep getting this err.

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;

The import com.fasterxml.jackson.databind.DeserializationFeature cannot be resolved


When I looked inside the maven dependency folder and navigated to
com.fasterxml.jackson.databind
I did not find any class with
DeserializationFeature
as well as
ObjectMapper


Any idea?

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.amazonaws</groupId>
<artifactId>aws-iot-device-sdk-java-pom</artifactId>
<version>1.0.1</version>
</parent>
<artifactId>aws-iot-device-sdk-java-samples</artifactId>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-iot-device-sdk-java</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<excludes>
<exclude>com/amazonaws/services/iot/client/sample/odin/*.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<configuration>
<excludePackageNames>*.odin.*</excludePackageNames>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

Answer

You need to add dependency for jackson-databind

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.8.0</version>
    </dependency>