有时候我们需要的 jar 在 maven 里不存在, 需要手动引入. 比如, 钉钉 sdk
- <dependency>
- <groupId>com.aliyun</groupId>
- <artifactId>taobao-sdk-java</artifactId>
- <version>1.0.0</version>
- <scope>system</scope>
- <systemPath>${project.basedir}/libs/taobao-sdk-java-auto_1479188381469-20180831.jar</systemPath>
- </dependency>
springboot 在打包的时候, 调用 spring-boot-maven-plugin, 执行 repackage 把 tomcat 和 resource,lib 等合成一个新的 jar. 想要将系统 jar 打进去, 必须配置 includeSystemScope. 最终会将 lib 放入 BOOT-INF\lib
- <build>
- <plugins>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <configuration>
- <includeSystemScope>true</includeSystemScope>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>build-info</goal>
- <goal>repackage</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
来源: https://www.cnblogs.com/woshimrf/p/springboot-package-3rdparty-lib.html