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

<parent>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-parent</artifactId>
   <version>2.3.0.RELEASE</version>
</parent>

mybatis的版本1.3.0

<dependency>
   <groupId>org.mybatis.spring.boot</groupId>
   <artifactId>mybatis-spring-boot-starter</artifactId>
   <version>1.3.0</version>
   <optional>true</optional>
</dependency>

二、问题排查

从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 ...</profiles>\r\n\r\n</project>\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,问题得到解决。

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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值