i'm Shendi
记录一下,简单的几步
我们将jar包复制到项目中
一般为resources下,在哪都行,只要在项目内,比如项目根目录
在 pom.xml 中引入
<dependency>
<groupId>随便填</groupId>
<artifactId>随便填</artifactId>
<version>随便填</version>
<scope>system</scope>
<systemPath>${project.basedir}/你jar在项目中的位置</systemPath>
</dependency>
其中 systemPath是代表 jar 包位置, 里面的 ${project.basedir} 代表项目根目录.
例如我项目 根目录下有lib目录, 并且里面有个jar为 jdbc.jar,那么我systemPath就为
<systemPath>${project.basedir}/lib/jdbc.jar</systemPath>
现在已经可以让项目直接运行了.
但是打包运行还不可以,还需要给 SpringBoot的打包插件配置 includeSystemScope 为 true
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>
最后
以上就是体贴苗条最近收集整理的关于SpringBoot引入本地jar包,打包后也可以的全部内容,更多相关SpringBoot引入本地jar包内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复