部署环境
项目用到docker部署,发布的时候发现后台程序报错。很奇怪在本地能包的项目到服务器上就不能运行,查看报错日志后,发现是找不到自己导入的本地jar包依赖。万番搜索之下,找到只需要加个依赖便可。
下面是我的错误提示和添加的依赖,等下次时间充裕我把我docker打包项目遇到的大坑也记录到博客中。
正文开始
警告 jar should not point at files within the project directory
[WARNING] 'dependencies.dependency.systemPath' for com.yinyuan:radarsdk:jar should not point at files within the project directory, ${project.basedir}/src/main/resources/jar/radar-sdk.jar will be unresolvable by dependent projects @ line 38, column 25

出错原因:maven 打包时没有将以 systemPath 这种形式引入的 jar 包,包含在内
解决办法:在 spring-boot-maven-plugin 插件中添加如下配置即可
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>
在使用Docker部署项目时遇到了一个问题,即本地能正常运行的项目在服务器上因找不到jar包依赖而报错。错误提示表明,Maven不支持将jar包依赖指向项目目录。解决办法是在spring-boot-maven-plugin插件配置中添加`<includeSystemScope>true</includeSystemScope>`,使得Maven在打包时包含系统路径的依赖。

1万+

被折叠的 条评论
为什么被折叠?



