gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 11:55:40 29 4
gpt4 key购买 nike

以下类(class)显示问题 - 无法解决导入 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 update 和 clean install 时,甚至没有下载相同版本的 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] ------------------------------------------------------------------------

最佳答案

使用

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

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

关于java - 编译错误包com.fasterxml.jackson.annotation不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57182618/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com