背景

对接快递助手物流轨迹追踪功能,其官方提供了JavaSDK,但是并没有把其上传到maven公共库,也就导致我们无法很舒服的使用maven方式直接引入项目。

jar文件名称为:kdzs-open-api-sdk-20211119.jar

解决

方案一 可以自己把jar文件上传的maven私服。

初创团队还未搭建maven私服,故没使用这个方式

方案二 使用maven scope system

第一步: jar包存储位置如图所示:

第二步:pom引入依赖方式如下

重点是scope,systemPath

<dependency>
    <groupId>com.kdzs</groupId>
    <artifactId>kdzs-open-api-sdk</artifactId>
    <version>20211119</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/lib/kdzs-open-api-sdk-20211119.jar</systemPath>
</dependency>

第三步:设置打包时包含SystemScope,否则打包的时候这个jar将被忽略

重点是<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>
Logo

电商企业物流数字化转型必备!快递鸟 API 接口,72 小时快速完成物流系统集成。全流程实战1V1指导,营造开放的API技术生态圈。

更多推荐