- 近日在工作中遇到遇到一个问题,在windows环境下可以正常运行,部署包放到服务器运行却报错。最后才发现Springboot在打包过程中没有将本地的lib包下的jar包打到部署包中。
idea如何加载本地的lib呢?
File->Project Structure...
在项目中增加相应的jar包即可
Springboot如何把本地lib包打到jar包中?
要进行修改相应的pom.xml文件
<dependency>
<groupId>com.company</groupId>
<artifactId>service</artifactId>
<version>0.0.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/service.jar</systemPath>
</dependency>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
打包后就可以在部署包中 \BOOT-INF\lib中找到相应的jar包