springboot项目引入第三方jar后打包运行时找不到类
179 字
1 分钟
springboot项目引入第三方jar后打包运行时找不到类
今天遇上这个问题,真是费劲,idea调试没问题,打jar包后再linux’服务器上运行就报错ClassNotfund我的解决办法如下:
1.首先检查你的jar包是否已经引入
idea是在file-》project structure-》Libraries中
2.在pom中添加你的jar包路径
你需要修改一下路径指向你的jar包。
${project.basedir}指向根目录,即src所在目录。
<dependency> <groupId>xxxxx</groupId> <artifactId>xxxxx</artifactId> <version>2.3.1-RELEASE</version> <scope>system</scope> <systemPath>${project.basedir}/libs/xxxxx.jar</systemPath></dependency>3.在pom中添加编译插件
版本和你的springboot版本保持一致
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.1.6.RELEASE</version> <configuration> <includeSystemScope>true</includeSystemScope> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions></plugin>打包运行一下,问题应该已经解决了,很开心能够帮助到你~
文章分享
如果这篇文章对你有帮助,欢迎分享给更多人!
springboot项目引入第三方jar后打包运行时找不到类
https://czxcly.cn/posts/springboot项目引入第三方jar后打包运行时找不到类/ 相关文章 智能推荐
1
SpringBoot-Jar包分离
技术文章 SpringBoot-Jar包分离
2
SpringBoot读取自定义配置文件
技术文章 SpringBoot读取自定义配置文件
3
对于xss过滤,前端传参字段中有特殊符号被过滤掉,导致请求报错的解决方法。
技术文章 对于xss过滤,前端传参字段中有特殊符号被过滤掉,导致请求报错的解决方法。
4
彻底卸载谷歌浏览器残留
其它教程 彻底卸载谷歌浏览器残留
5
VisualStudio安装时共享组件、工具和SDK安装位置不能更改的问题
技术文章 VisualStudio安装时共享组件、工具和SDK安装位置不能更改的问题
随机文章 随机推荐