导入依赖项时出错

时间:2016-09-20 05:14:31

标签: java maven aws-iot

我来自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时,我找不到任何包含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>

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:1)

您需要为jackson-databind

添加依赖项
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.8.0</version>
    </dependency>