1.在resources下面新建lib文件夹,并把jar包文件放到这个目录下
2.在pom.xml里面添加jar信息,systemPath是本地jar的路径。${project.basedir}是系统的常量,不用改
<dependency>
<groupId>com.aaa.bb</groupId>
<artifactId>bb-sdk</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/bb-sdk-1.0.0.jar</systemPath>
</dependency>
3maven提示import changes
如果项目打包时,需要将本地jar包导入,需要在pom文件中添加如下内容
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
全部代码如下:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>