All Products
Search
Document Center

Simple Message Queue (formerly MNS):Install the SDK

Last Updated:Mar 11, 2026

Add the Simple Message Queue (formerly MNS) Java SDK to your project so you can send and receive messages through the SMQ API.

Prerequisites

Before you begin, make sure you have:

To verify your Java version, run:

java -version

Add the SDK dependency

Add the following dependency to your pom.xml:

<!-- SMQ SDK for Java -->
<dependency>
    <groupId>com.aliyun.mns</groupId>
    <artifactId>aliyun-sdk-mns</artifactId>
    <!-- Replace with the latest version from the version history page -->
    <version>${Latest version of MNS SDK for Java}</version>
</dependency>

Select a version based on your business requirements. We recommend that you use the latest version. For available versions, see Versions.

Add JAXB dependencies for Java 9+

Java 9 removed Java Architecture for XML Binding (JAXB) from the default classpath. If your project runs on Java 9 or later, add the following JAXB dependencies based on your module setup.

Classpath (non-module system)

Add these dependencies to your pom.xml:

<!-- JAXB API: XML binding interfaces -->
<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.3.1</version>
</dependency>

<!-- JavaBeans Activation Framework: required by JAXB -->
<dependency>
    <groupId>javax.activation</groupId>
    <artifactId>activation</artifactId>
    <version>1.1.1</version>
</dependency>

<!-- JAXB runtime: reference implementation -->
<dependency>
    <groupId>org.glassfish.jaxb</groupId>
    <artifactId>jaxb-runtime</artifactId>
    <version>2.3.9</version>
</dependency>

Module system (JPMS)

If your project uses the Java Platform Module System (JPMS), add the following requires declarations to your module-info.java file:

module your.module.name {
    requires java.xml;          // Standard XML module
    requires aliyun.sdk.mns;    // SMQ SDK module

    // Add other module dependencies as needed
}