1. 在pom中配置依赖
<dependency>
<groupId>com.demo.dbct.log</groupId>
<artifactId>dbct-log-client-starter</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>D:/repository/lib/dbct-log-client-starter-1.0.0-SNAPSHOT.jar</systemPath>
</dependency>
2. 避免团队的其他成员使用不了
调整:jar包放到项目里,路径改为相对路径:
<systemPath>${project.basedir}/lib/dbct-log-client-starter-1.0.0-SNAPSHOT.jar</systemPath>
3. spring-boot打包插件是不会将本地依赖jar文件打进部署包
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
或则: 指定打包对应路径下内容,及打包后的路径
<resources>
<!-- 指定sdk打包后的路径 -->
<resource>
<directory>/lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</resources>
本文详细介绍如何在Maven项目中正确配置本地依赖,包括在pom.xml中设置依赖、调整依赖路径为相对路径以便团队协作,以及配置spring-boot插件以确保本地依赖的jar文件能被打包进最终的部署包中。

827

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



