springboot导入本地jar包
首先在src下建目录lib,并将需要的本地jar包放入
在pom.xml下修改如下
<!-- 导入云顿数据风控的jar -->
<dependency>
<groupId>aliyun</groupId>
<artifactId>aliyun-java-sdk-afs</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/lib/aliyun-java-sdk-afs-1.0.0.jar</systemPath>
</dependency>
<dependency>
<groupId>aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>3.0.6</version>
<scope>system</scope>
<systemPath>${basedir}/src/lib/aliyun-java-sdk-core-3.0.6.jar</systemPath>
</dependency>
<!-- 导入云顿数据风控的jar END-->
打包
修改plugin中,添加配置<includeSystemScope>true</includeSystemScope>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>
可能出现的warning
[WARNING] Some problems were encountered while building the effective model for com.seniortech:beauty-hair-cms:jar:1.0.0
[WARNING] 'dependencies.dependency.systemPath' for aliyun:aliyun-java-sdk-afs:jar should not point at files within the project directory, ${basedir}/src/lib/aliyun-java-sdk-afs-1.0.0.jar will be unresolvable by dependent projects @ line 111, column 25
[WARNING] 'dependencies.dependency.systemPath' for aliyun:aliyun-java-sdk-core:jar should not point at files within the project directory, ${basedir}/src/lib/aliyun-java-sdk-core-3.0.6.jar will be unresolvable by dependent projects @ line 118, column 25
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
解决方法,Use ${pom.basedir} instead of ${project.basedir}.
修改后的pom
<!-- 导入云顿数据风控的jar -->
<dependency>
<groupId>aliyun</groupId>
<artifactId>aliyun-java-sdk-afs</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${pom.basedir}/src/lib/aliyun-java-sdk-afs-1.0.0.jar</systemPath>
</dependency>
<dependency>
<groupId>aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>3.0.6</version>
<scope>system</scope>
<systemPath>${pom.basedir}/src/lib/aliyun-java-sdk-core-3.0.6.jar</systemPath>
</dependency>
<!-- 导入云顿数据风控的jar END-->