springboot公共模块打包_Springboot多模块打包成jar包

项目结构:

其中,coreservice包含DAO层代码,采用Mybatis框架,webservice为web层,springboot启动类包含其中,webservice依赖coreservice,打包的时候要注意以下几点:

(1)主pom文件不要包含build标签

(2)web模块的pom文件中包含build内容!

webservice中的build内容:

org.springframework.boot

spring-boot-maven-plugin

shangfei.SpringBootStartApplication

repackage

org.apache.maven.plugins

maven-compiler-plugin

1.8

1.8

org.apache.maven.plugins

maven-surefire-plugin

2.19.1

true

(3)coreservice中的build内容

models

*.txt

src/main/resources

**/*.xml

*.xml

*.properties

org.apache.maven.plugins

maven-compiler-plugin

1.8

1.8

(4)打包成Jar包之后一直连接不了数据库,后来在web层中的application.properties中要加入连接数据库配置

按道理来说webservice依赖的是coreservice,coreservice中已经包含了mybatis的配置文件,不用再额外配置了,这里一直没弄明白,但是加上去就连接正常了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值