This topic uses aliyun-java-sdk-green 3.6.2 as an example to describe how to install Content Moderation SDK for Java.
Preparations
Environment requirement: 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 only need to add relevant dependencies to the pom.xml file. For example, if you want to use aliyun-java-sdk-green 3.6.2, 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.2</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.51</version>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>2.8.3</version>
</dependency>
Some 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.