Enterprise Distributed Application Service (EDAS) provides a Java SDK that wraps the EDAS API into typed request and response objects. This guide covers SDK installation, authentication setup, and a working example that lists applications and their deploy groups.
Prerequisites
Before you begin, make sure that you have:
Java Development Kit (JDK) 1.6 or later. Download it from Oracle JDK
Apache Maven (required for the Maven installation method)
Install the SDK
Choose a method based on whether your build machine has Internet access.
Option 1: Add Maven dependencies (recommended)
If your build machine has Internet access, add the following dependencies to your pom.xml:
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.5.0</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-edas</artifactId>
<version>3.18.0</version>
</dependency>Option 2: Import JAR packages manually
If your build machine does not have Internet access, download the JAR packages from a connected machine and copy them to your project:
Download Alibaba Cloud SDK for Java (the core SDK).
Download Alibaba Cloud EDAS SDK for Java (the EDAS-specific SDK).
Add both JAR files to your project classpath.
Set up authentication
Every API call requires an AccessKey ID and an AccessKey secret that belong to your Alibaba Cloud account or a RAM user. For details on these and other common parameters, see Common parameters for API calls.
Create a DefaultProfile with your region ID and credentials, then pass it to a DefaultAcsClient:
// Replace with your region ID, AccessKey ID, and AccessKey secret
String regionId = "cn-hangzhou";
String accessKeyId = "<your-access-key-id>";
String accessKeySecret = "<your-access-key-secret>";
DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
DefaultAcsClient client = new DefaultAcsClient(profile);Replace the following placeholders with your actual values:
Placeholder | Description | Example |
| The AccessKey ID of your Alibaba Cloud account or RAM user | LTAI5tXxx |
| The AccessKey secret of your Alibaba Cloud account or RAM user | xXxXxXx |
To avoid hardcoding credentials in your source code, store the AccessKey ID and AccessKey secret in environment variables and read them at runtime.
Request and response pattern
Each EDAS API operation maps to a pair of Java classes:
Class | Purpose |
| Constructs the API request. Set required parameters on this object. |
| Carries the result returned by the API. |
Call DefaultAcsClient.getAcsResponse() with a request object to run the API operation and receive the corresponding response object.
For example, the ListApplication operation uses ListApplicationRequest and ListApplicationResponse. The ListDeployGroup operation uses ListDeployGroupRequest and ListDeployGroupResponse.
Example: List applications and deploy groups
The following example authenticates with EDAS, retrieves all applications in a region, and prints each application's deploy groups.
Automatic endpoint discovery
When aliyun-java-sdk-core is version 4.4.3 or later and aliyun-java-sdk-edas is version 2.52.1 or later, the SDK resolves the correct API endpoint automatically based on the region ID. No manual endpoint configuration is required.