springboot多模块的微服务项目,本地编译运行没有问题,单独打包部署就报这个错误,最后确认是maven打包的问题引入的一个本地jar包没有打入进去,本地jar包的引入方式:
<dependency>
<groupId>com.zhongjiao.sdk</groupId>
<artifactId>openapi-sdk</artifactId>
<version>6.0</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/xxx-sdk-6.0.jar</systemPath>
</dependency>
解决方式就是在配置打包插件的地方配置<includeSystemScope>true</includeSystemScope>
这样配置之后,本地引入的jar包才能被打到运行的jar包里面
如下方式配置:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
<finalName>location-service</finalName>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**</include>
</includes>
</resource>
</resources>
</build>
网友评论