有些類庫我們會放在本地resources目錄,當然如果公用倉庫里有它,並且是免費的,還是建議直接引用倉庫里的,這樣在版本更新上和源代碼體積上都是有優勢的,下面解決引用本地jar的方法。
資源文件
/resources/lib/abc.jar
在pom里添加引用
<dependencies>
<dependency>
<groupId>com.bdyh.common</groupId>
<artifactId>common</artifactId>
<version>0.0.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/aspose-words-15.8.0-jdk16.jar</systemPath>
</dependency>
</dependencies>
pom里添加本地文件支持
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>
這樣,本地的jar包就算了引到項目里了。