如果項目不幸需要依賴不在中央倉庫的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>