1、在项目resources目录下创建lib目录,将jar包复制进去

2、pom.xml添加引入jar包依赖
<dependency>
<groupId>com</groupId>
<artifactId>aspose-words-18.10-jdk16</artifactId>
<version>18.10</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/aspose-words-18.10-jdk16.jar</systemPath>
</dependency>
3、plugins标签中添加如下配置信息
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- 主方法所在路径 -->
<mainClass>com.pingchuan.polish.web.Application</mainClass>
<includeSystemScope>true</includeSystemScope>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
本文介绍了如何在Spring Boot项目中引入外部jar包。首先,在resources目录下创建lib目录并放入jar文件。接着,在pom.xml中通过systemPath配置添加依赖,并设置includeSystemScope为true,确保jar包在打包时被包含。最后,配置spring-boot-maven-plugin以重新打包应用,确保主方法和系统范围的依赖都被正确处理。
2352

被折叠的 条评论
为什么被折叠?



