This topic describes how to install Content Moderation SDK for Java. aliyun-java-sdk-green 3.6.6 is used as an example.
Prerequisites
Java 1.6 or later is installed.
Note You can run the
java -version
command to check the Java version.
Install the SDK
To use aliyun-java-sdk-green in your Maven project, you need only to add relevant dependencies to the pom.xml file. For example, if you want to use aliyun-java-sdk-green 3.6.6, add the following
content to
<dependencies>
: <dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.1.1</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-green</artifactId>
<version>3.6.6</version>
</dependency>
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>2.8.3</version>
</dependency>
Part of the Java sample code is compiled based on Java dependencies to read files
and convert strings. You can add the following content to
<dependencies>
as needed:<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
If you want to submit a local or binary file for content moderation, download and import the Extension.Uploader utility class into your project.