Set up your Java environment

更新时间:
复制 MD 格式

Before you use SDK for Java to send and subscribe to messages in ApsaraMQ for RocketMQ, install the required tools and add the SDK dependency to your project.

Prerequisites

Install SDK for Java

The mq-http-sdk artifact is available from Maven Central. Replace X.X.X with the latest version listed there, or check the Release notes.

Add the following dependency to your pom.xml file:

<dependency>
    <groupId>com.aliyun.mq</groupId>
    <artifactId>mq-http-sdk</artifactId>
    <version>X.X.X</version>
    <classifier>jar-with-dependencies</classifier>
</dependency>
Note

The jar-with-dependencies classifier bundles all required dependencies into a single JAR. This prevents dependency conflicts but increases the JAR size. If you manage transitive dependencies yourself, remove the jar-with-dependencies classifier to use the standard artifact.