SpringBoot打包第三方本地jar包、maven打包本地lib下的jar包
有一些包我们maven仓库找不到,那就只能在项目中引入本地jar包文件,但是maven打包的时候会显示没有这个jar包
首先我们把jar包放到resource下的lib文件夹
然后pom文件
<dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-io</artifactId> <version>2.2</version> <scope>system</scope> <systemPath>${basedir}/src/main/resources/lib/commons-io-2.2.jar</systemPath> </dependency>
然后加个插件配置
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.3.7.RELEASE</version> <configuration> <includeSystemScope>true</includeSystemScope> <mainClass>com.voyah.provider.OtaProviderApplication</mainClass> </configuration> <executions> <execution> <id>repackage</id> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin>
主要是:
<includeSystemScope>true</includeSystemScope>
这部分
-----------------------有任何问题可以在评论区评论,也可以私信我,我看到的话会进行回复,欢迎大家指教------------------------
(蓝奏云官网有些地址失效了,需要把请求地址lanzous改成lanzoux才可以)