美文网首页
SpringBoot IDEA+Maven引入本地Jar包

SpringBoot IDEA+Maven引入本地Jar包

作者: 千年的心 | 来源:发表于2021-03-17 15:36 被阅读0次

问题

在开发时我们通常会有自己的jar包,这些包没有上传到maven中心仓库,这时候我们需要怎么快速的引用和打包呢?

解决方案

1.项目工程目录下新建目录lib,并将需要引入jar包放入lib目录下,如图是我自己编写的微信支付对接SDK

image.png

2.修改pom文件,使用本地引用方式

 <dependency>
            <groupId>sharp-weapon</groupId>
            <artifactId>wx-pay-sdk</artifactId>
            <version>1.0.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/wx-pay-sdk-1.0.0.jar</systemPath>
</dependency>

3.在plugin中设置打包

<plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork>
                    <includeSystemScope>true</includeSystemScope>
                </configuration>
</plugin>

4.正常maven打包,我们用解压软件打开发现在\BOOT-INF\lib中找到了本地的jar包

image.png

相关文章

网友评论

      本文标题:SpringBoot IDEA+Maven引入本地Jar包

      本文链接:https://www.haomeiwen.com/subject/hbkecltx.html