1)在项目目录下创建文件存放外部jar包
2)添加依赖,注意scope是system,需要写systemPath的外部jar路径
3)打包时,需要配置外部jar加入当前打包的jar
<dependency>
<groupId>com.admin</groupId>
<artifactId>admin-0.0.1-SNAPSHOT.jar</artifactId>
<scope>system</scope>
<systemPath>${pom.basedir/local-repo/admin-0.0.1-SNAPSHOT.jar}</systemPath>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!--maven打包时会将外部引入的jar包(比如根目录下或者resource文件下外部jar包),打包到项目jar-->
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>