如果项目不幸需要依赖不在中央仓库的jar包,可以通过配置systeam方式引用依赖。
<dependency>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${pom.basedir}/lib/artifactId.jar</systemPath>
</dependency>
同时需要添加编译插件,使依赖打进jar包。
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
<!-- 是否限制解压缩 -->
<executable>false</executable>
</configuration>
</plugin>
</plugins>
</build>