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>


这部分
posted @   yvioo  阅读(455)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示