maven报The POM for com.**** is invalid, transitive dependencies (if any) will not be available问题解决

一、运行环境

spring-boot版本2.3.0

The POM for org.mybatis.spring.boot:mybatis-spring-boot-starter:jar:1.3.0 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while

building the effective model for org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.0

   org.springframework.boot
   spring-boot-starter-parent
   2.3.0.RELEASE

mybatis的版本1.3.0

   org.mybatis.spring.boot
   mybatis-spring-boot-starter
   1.3.0
   true

二、问题排查

从git上拉下来的代码,刚开始是MyBatisConfigurer配置类的两个包导不进来

import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;

所以将问题定位在mybatis-spring-boot-starter的包上,怀疑是包损坏了,删除包之后重新下载,仍出现上述情况。排除jar损坏的原因。

后来刷新maven仓库时报了下面的警告

[WARNING]The POM org.mybatis.spring.boot:mybatis-spring-boot-starter:jar:1.3.0 for is invalid, transitive dependencies (if any) will not be available

随后我就去csdn上查找解决方案,都没有很好的得到解决

最后看到了“兵工厂三剑客”这位博主的博客按着他的处理问题的流程,通过打印maven的日志信息

打印日志指令如下:

 mvn -X -U clean package

查看日志发现下面报错信息

[WARNING] The POM for org.mybatis.spring.boot:mybatis-spring-boot-starter:jar:1.3.0 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while
 building the effective model for org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.0
[FATAL] Non-parseable POM E:\MavenRepository\org\mybatis\mybatis-parent\28\mybatis-parent-28.pom: processing instruction can not have PITarget with reserved xml name (position: END_TA
G seen ...\r\n\r\n\r\n<?xml ... @1096:7)  @ E:\MavenRepository\org\mybatis\mybatis-parent\28\mybatis-parent-28.pom, line 1096, column 7

注:[FATAL] 这个输出的消息等级更加严格译为致命的,是比error等级还要高的异常

附加知识点:log4j定义了8个级别的log(除去OFF和ALL,可以说分为6个级别),优先级从高到低依次为:OFF、FATAL、ERROR、WARN、INFO、DEBUG、TRACE、 ALL。

三、解决方案

最终将问题定位到 E:\MavenRepository\org\mybatis\mybatis-parent\28\mybatis-parent-28.pom, line 1096, column 7这个文件上

然后根据路径找到该文件,删除该文所在的文件夹,重启idear,更新maven,问题得到解决。

具体到底时详细那个地方造成异常原因,这个我并没找到,期待那位大佬,能够将深层次的的原因描述一下。

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://www.net2asp.com/96ae54ef20.html