1. 配置Maven仓库地址,在pom添加如下maven仓库依赖。
    <repositories>
        <repository>
            <id>alimaven</id>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        </repository>
    </repositories>
  2. maven 依赖,在工程 pom.xml dependencies 下添加如下依赖。
    <dependencies>
        <dependency>
            <groupId>com.aliyun.alink.linksdk</groupId>
            <artifactId>iot-linkkit-java</artifactId>
            <version>1.2.0.1</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.aliyun.alink.linksdk</groupId>
            <artifactId>public-cmp-java</artifactId>
            <version>1.3.6</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.1</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.40</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>

JAR 依赖方式

Java版设备端SDK依赖列表如下,可以到 阿里云Maven仓库 下载并依赖。

type groupId artifactId version description
LinkKit SDK com.aliyun.alink.linksdk iot-linkkit-java 1.2.0.1 LinkKit API
LinkKit SDK com.aliyun.alink.linksdk iot-device-manager-java 1.2.0.2 device manager
LinkKit SDK com.aliyun.alink.linksdk public-channel-gateway-java 1.2.2 gateway
LinkKit SDK com.aliyun.alink.linksdk public-tmp-java 1.0.2 物模型
LinkKit SDK com.aliyun.alink.linksdk public-cmp-java 1.3.5 连接管理
LinkKit SDK com.aliyun.alink.linksdk iot-apiclient 1.0.0 https请求
LinkKit SDK com.aliyun.alink.linksdk network-core 1.0.0 基础网络请求库
LinkKit SDK com.aliyun.alink.linksdk iot-mqttclient 1.0.6 长连接
LinkKit SDK com.aliyun.alink.linksdk tools-java 1.0.1 -
base SDK com.google.code.gson gson 2.8.1 json解析库
base SDK com.alibaba fastjson 1.2.40 json解析库
base SDK com.squareup.okhttp3 okhttp 3.0.1 -
base SDK com.squareup.okio okio 1.6.0 -
base SDK com.aliyun.alink.linksdk opensource-paho-java 1.2.1 Mqtt协议实现

Java SDK Demo

Java SDK提供Demo,供您参考使用。单击下载Java SDK Demo。下载本Demo将默认您同意本软件许可协议。接口定义参见 Api Reference