springboot打成jar包并携带第三方jar

1.修改打包方式为jar

<packaging>jar</packaging>

2.添加第三方依赖到pom文件

我的第三方依赖包在resources目录下的lib目录下(地址可以随便写,但是路径要正确)
<dependency>
<groupId>otc</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/otc-commons-logging-1.2.jar</systemPath>
</dependency>
3.修改plugin
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
如果找不到资源文件可以添加(视情况而定)
<!--<resources>
<resource>
<includes>
<include>**/*.properties</include>
<include>**/*.yml</include>
<include>**/*.xml</include>
</includes>
</resource>
</resources>-->

到此springboot携带第三方jar包打成jar包结束。

不足之处还请指正。

猜你喜欢

转载自www.cnblogs.com/wlv1314/p/12127878.html