彻底解决maven项目中jackson编译报错,提示Failure to find :jackson-bom:pom

时间:2024-12-20 07:12:10

今天在架构改造中发现,原来eclipse项目中使用了jackson依赖,编译不报错而且不会提示缺少。在新的springboot2.1.4的项目中发现报错,错误消息如下:

  1. :maven-clean-plugin:3.1.0:clean
  2. [INFO] Scanning for projects...
  3. [ERROR] [ERROR] Some problems were encountered while processing the POMs:
  4. [ERROR] Non-resolvable import POM: Failure to find :jackson-bom:pom:1.9.9 in http:///nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of aliyun has elapsed or updates are forced @ :spring-boot-dependencies:2.1., C:\Users\renkai721\.m2\repository\org\springframework\boot\spring-boot-dependencies\2.1.\spring-boot-dependencies-2.1., line 605, column 13
  5. @
  6. [ERROR] The build could not read 1 project -> [Help 1]
  7. [ERROR]

 

操作剖析:

1、我们常规的使用方式如下,现在顶部定义一个版本

  1. <properties>
  2. <>1.9.9</>
  3. </properties>

2、在dependency中使用方式如下,这样就会报错。

  1. <dependency>
  2. <groupId></groupId>
  3. <artifactId>jackson-core-lgpl</artifactId>
  4. <version>${}</version>
  5. </dependency>
  6. <dependency>
  7. <groupId></groupId>
  8. <artifactId>jackson-core-asl</artifactId>
  9. <version>${}</version>
  10. </dependency>
  11. <dependency>
  12. <groupId></groupId>
  13. <artifactId>jackson-mapper-lgpl</artifactId>
  14. <version>${}</version>
  15. </dependency>
  16. <dependency>
  17. <groupId></groupId>
  18. <artifactId>jackson-mapper-asl</artifactId>
  19. <version>${}</version>
  20. </dependency>

 

 

解决方法如下:

1、删除顶部定义的版本,直接写在version中。正确的写法如下

  1. <dependency>
  2. <groupId></groupId>
  3. <artifactId>jackson-core-lgpl</artifactId>
  4. <version>1.9.9</version>
  5. </dependency>
  6. <dependency>
  7. <groupId></groupId>
  8. <artifactId>jackson-core-asl</artifactId>
  9. <version>1.9.9</version>
  10. </dependency>
  11. <dependency>
  12. <groupId></groupId>
  13. <artifactId>jackson-mapper-lgpl</artifactId>
  14. <version>1.9.9</version>
  15. </dependency>
  16. <dependency>
  17. <groupId></groupId>
  18. <artifactId>jackson-mapper-asl</artifactId>
  19. <version>1.9.9</version>
  20. </dependency>

2、重新clean,试一试。