问题:项目在本地可以运行,但是打包部署服务器时,提示没有相关依赖的本地lib中的.jar文件。
解决办法:
1、确保pom文件中有依赖本地的jar,类似如下:
<dependency>
<groupId>com.common.util</groupId>
<artifactId>util</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${project.basedir}/util-1.0.0.jar</systemPath>
</dependency>
2、在添加如下配置
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
例子:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!--添加如下配置-->
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
<!--添加如上配置-->
</plugin>
3、clean后重新打包