ieda ts文件报错_idea springBoot多模块编译报错“程序包XXX不存在”

在创建的Spring Boot多模块项目中,pchat-center子模块依赖pchat-user子模块,但在编译时出现'程序包XXX不存在'的错误。原因是Spring Boot默认打包将类置于BOOT-INF下,导致找不到类。解决方案是在被引入项目的pom.xml中添加spring-boot-maven-plugin插件,设置includeNestedProjects为true,重新打包后,BOOT-INF问题解决。
摘要由CSDN通过智能技术生成

1.异常现象

建了一个多模块的spring boot项目

pchat-center子模块要导入 pchat-user 的jar包

pchat-center的pom文件如下:

pchat-center子模块包依赖了pchat-user子模块包

代码如下:

代码没显示任务异常,没有标红显示。

maven编译结果如下:

[error] Talled to eeecute goasl eang apxche. rmL pluginr:arer-tamptler lugim:3.7.g:tungtle (ontuit-comptte) a project pchat-crtet: Compllation fallure; Compiation hallime:

[error] Eiac/pchlL/cdat-cmtcx/sxcsin/ixea/cm/laxrtocbatcmal xilata/amilz/iml/buaknGltcxlsricxnctlmzl.lanxi 48]程序包com.Ioeat.pcha1.1t.Bto.1e不存在

[error] /hmelchut/osthutountsalosbuin/ialsmdunmlaaatlomatsritaasndslhmul/bataCliseluisocelhi.hao:[24 5]找不到符号

[error]符号: 类 BtbororideathesSearice

[error]位置: 类lopthut.CHs.sernoeniuotDuCHmibrernpus

明明引入了pchat-user包,而且显示成功引入了,但不能运行,运行或者编译就出错。

2 异常原因

spring boot 默认打包会打包成可以启动的jar包

类包含在了BOOT-INF里面,所以找不到类

3.解决方法

maven修改打包方式,在被引入的项目的pom加入

org.springframework.boot

spring-boot-maven-plugin

true

再次打包

目录BOOT-INF没有了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值