Help Center/ Content Moderation/ SDK Reference/ Using the SDK (Java)/ Obtaining and Installing the Java SDK
Updated on 2023-07-17 GMT+08:00

Obtaining and Installing the Java SDK

You are advised to use the Java SDK for Content Moderation by installing dependencies through Apache Maven.

  1. Download and install Apache Maven on your operating system.
  2. After installing and configuring Maven, run the mvn -v command. Maven is installed successfully if the following information is displayed.

  3. Add dependencies to an existing Maven project or use an integrated development environment (IDE) to create a Maven project.

    To create a Maven project using IntelliJ IDEA (an example IDE), perform the following steps (skip if you already have a Maven project):

    1. Start IntelliJ IDEA.
    2. Choose File > New > project...
    3. In the displayed New Project dialog box, click Maven and then Next.
    4. Specify GroupId and ArtifactId, and click Next.
    5. Specify Project name and Project location, and click Finish.

  4. Add dependency items to the pom.xml file of the Maven project.

    The following is the dependency for Content Moderation SDK 3.0.55:
    <dependency>
        <groupId>com.huaweicloud.sdk</groupId>
        <artifactId>huaweicloud-sdk-moderation</artifactId>
        <version>3.0.55</version>
    </dependency>

    The following sample code uses the fastjson dependency (ignore and delete it if it is not required):

    <dependency>
    	<groupId>com.alibaba</groupId>
    	<artifactId>fastjson</artifactId>
    	<version>1.2.70</version>
    </dependency>