引入的jar包的类调用提示ClassNotFoundException
记录一个问题
报错信息
引用了一个第三方jar包内的类,jar包是在本地导入的,本地没有报错,打包到服务器上出现 ClassNotFoundException 报错
原因
<dependency>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/jar/</systemPath>
</dependency>
由于jar包是从系统内引入的,默认情况下,Maven 会忽略系统范围的依赖项,所以打包时系统路径直接引入的会被忽略
处理方式
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>