在main下创建目录lib
1、把jar包复制到lib目录下
2、在pom文件中添加依赖如下
当scope值为system时,项目依赖取systemPath路径下的jar包
<dependency> <groupId>com.jd.open.api</groupId> <artifactId>open-api-sdk</artifactId> <scope>system</scope> <systemPath>${project.basedir}/src/main/lib/open-api-sdk-2.0.jar</systemPath> </dependency>
3、当scope为system的时候,打包不会自动打包进去,需要添加一个参数
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>${spring-boot-maven-plugin.version}</version>
<!--当scope为system时增加配置--> <configuration> <includeSystemScope>true</includeSystemScope> </configuration> </plugin>
4、提交jar到git中
4.1、maven项目idea默认会把jar给过滤掉
去掉maven项目下的.gitignore文件的 *.jar,*.lib,就可以提交了。