springboot多模块打包报错,找不到xxx包,找不到xxx类

ne-parent是父模块

ne-commo是公共组件模块

ne-web是项目入口模块

错误:

ne-web模块打包的时候,找不到ne-commo公共组件模块的包,找不到ne-commo公共组件模块的类,

原因:

1、ne-commo不能添加spring-boot-maven-plugin插件,如果添加了spring-boot-maven-plugin,当运行maven的package打包命令时,这个SpringBoot插件会在Maven的package后进行二次打包,目的为了生成可执行jar包;

2、二次打包后其他模块引用ne-commo模块就会报错找不到xxx包,找不到xxx类错误

ne-commo子模块的pom.xml中build内容如下:

org.apache.maven.plugins maven-resources-plugin UTF-8 ne-parent父模块的pom.xml中bulid内容如下:

4.0.0
com.upincar.ne.parent
ne-parent
1.0-SNAPSHOT
pom

org.springframework.boot spring-boot-starter-parent 2.0.1.RELEASE ne-commo ne-web ${basedir}/src/main/resources true **/* org.apache.maven.plugins maven-compiler-plugin 1.8 1.8 UTF-8 ${java.home}\lib\rt.jar;${java.home}\lib\jce.jar ne-web子模块的pom.xml配置如下:

4.0.0
com.upincar.ne.web
ne-web
war

com.upincar.ne.parent ne-parent 1.0-SNAPSHOT ne-web src/main/resources false **/*.woff **/*.woff2 **/*.ttf org.springframework.boot spring-boot-maven-plugin com.upincar.xigua.XiguaApplication repackage 注:进行如上配置之后,要发布的子模块打war包时,先打包公共模块,再打包要发布的子模块,打包要发布的子模块时就不会报找不到xxx包,找不到xxx类的错误了

原文链接:https://blog.csdn.net/qq_42714869/article/details/83537794

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值