今天在架构改造中发现,原来eclipse项目中使用了jackson依赖,编译不报错而且不会提示缺少。在新的springboot2.1.4的项目中发现报错,错误消息如下:
-
:maven-clean-plugin:3.1.0:clean
-
[INFO] Scanning for projects...
-
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
-
[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
-
@
-
[ERROR] The build could not read 1 project -> [Help 1]
-
[ERROR]
操作剖析:
1、我们常规的使用方式如下,现在顶部定义一个版本
-
<properties>
-
<>1.9.9</>
-
</properties>
2、在dependency中使用方式如下,这样就会报错。
-
<dependency>
-
<groupId></groupId>
-
<artifactId>jackson-core-lgpl</artifactId>
-
<version>${}</version>
-
</dependency>
-
<dependency>
-
<groupId></groupId>
-
<artifactId>jackson-core-asl</artifactId>
-
<version>${}</version>
-
</dependency>
-
<dependency>
-
<groupId></groupId>
-
<artifactId>jackson-mapper-lgpl</artifactId>
-
<version>${}</version>
-
</dependency>
-
<dependency>
-
<groupId></groupId>
-
<artifactId>jackson-mapper-asl</artifactId>
-
<version>${}</version>
-
</dependency>
解决方法如下:
1、删除顶部定义的版本,直接写在version中。正确的写法如下
-
<dependency>
-
<groupId></groupId>
-
<artifactId>jackson-core-lgpl</artifactId>
-
<version>1.9.9</version>
-
</dependency>
-
<dependency>
-
<groupId></groupId>
-
<artifactId>jackson-core-asl</artifactId>
-
<version>1.9.9</version>
-
</dependency>
-
<dependency>
-
<groupId></groupId>
-
<artifactId>jackson-mapper-lgpl</artifactId>
-
<version>1.9.9</version>
-
</dependency>
-
<dependency>
-
<groupId></groupId>
-
<artifactId>jackson-mapper-asl</artifactId>
-
<version>1.9.9</version>
-
</dependency>
2、重新clean,试一试。