编译错误包 com.fasterxml.jackson.annotation 不存在

2022-09-03 07:03:44

以下类显示问题 - 无法解决导入 com.fasterxml.jackson -

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;


@JsonIgnoreProperties(ignoreUnknown=true)
public class MerchantDetailsDto {

运行时编译错误clean install -

[ERROR] COMPILATION ERROR : 

[INFO] -------------------------------------------------------------

[ERROR] /Path/to/src/main/java/com/citruspay/common/dto/merchant/MerchantDetailsDto.java:[9,40] package com.fasterxml.jackson.annotation does not exist

[ERROR] /Path/to/src/main/java/com/citruspay/common/dto/merchant/MerchantDetailsDto.java:[11,2] cannot find symbol

  symbol: class JsonIgnoreProperties

pom的定义是这个,它位于一个项目的pom中,该项目被定义为当前项目的依赖关系 -

<dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson-core.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>${jackson-core.version}</version>
        </dependency>

<jackson-core.version>2.6.1</jackson-core.version>

我检查了这个组件的maven存储库,它似乎没有任何依赖关系。

我尝试将版本更改为最新版本 - 2.10.0.pr1,并尝试对依赖项项目进行maven更新,但找不到在.m2中下载的jar。有两个路径,其中与此组件对应的目录结构存在 -

.m2/fasterxml/jackson/core/jackson-annotations

.m2/repository/com/fasterxml/jackson/core/jackson-annotations

我不确定其中哪一个是实际的,所以我尝试从这两个中删除现有的版本目录,但是当我尝试maven更新和全新安装时,即使是相同的版本jar也没有下载。

将不胜感激任何指点。

更新

依赖项目上的全新安装命令的输出 -

[INFO] Scanning for projects...
[INFO] 
[INFO] ------< com.project.path.to.project-dependency >------
[INFO] Building project-dependency 1.0-SNAPSHOT
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ project-dependency ---
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ citruspay-spring-dependencies ---
[INFO] Installing /Path/to/dependency/project/pom.xml to /path to/.m2/repository/com/project/path/to/dependency/1.0-SNAPSHOT/project-dependency-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.417 s
[INFO] Finished at: 2019-07-24T17:25:42+05:30
[INFO] ------------------------------------------------------------------------

答案 1

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

这将引入两个传递依赖项:


答案 2

推荐