导入依赖时出错

Err when importing a dependency

我有 ruby 编程背景,我已经开始学习 java。我绝对爱上了它。现在我正在尝试 运行 示例 aws iot java sdk 项目,但我一直收到这个错误。

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

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

当我查看 Maven 依赖文件夹并导航到 com.fasterxml.jackson.databind 时,我没有找到任何 class 和 DeserializationFeature 以及 ObjectMapper

有什么想法吗?

<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>

你能确认 jar 的版本....它是 jackson.databind.jar 的一部分......你可能需要正确的版本

您需要为 jackson-databind 添加依赖项

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