springboot在idea正常运行,但是打包jar后。运行报缺少类文件java.lang.ClassNotFoundException
问题描述
因为运用到了下载的第三方jar但是打包之后,运行jar文件报java.lang.ClassNotFoundException。描述的就是那个第三方jar包没有给打上。
我最后的解决方式
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.2.4.RELEASE</version>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
我之前的spring-boot-maven-plugin是没有
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
这个标签的
下文摘抄自(傲娇__大头兵)
在sprinboot项目中pom.xml文件加true,代表maven打包时会将外部引入的jar包(比如在根目录下或resource文件下新加外部jar包)打包到项目jar,在服务器上项目才能运行,不加此配置,本地可以运行,因为本地可以再lib下找到外部包,但是服务器上jar中是没有的。