Cloud Toolkit lets you deploy applications to EDAS using Maven. This method is faster than the traditional process of packaging an application and deploying it from the console because you can deploy applications directly from the command line. This topic describes how to use the toolkit-maven-plugin to deploy an application to an ECS cluster in EDAS.
Prerequisites
You have downloaded and installed Maven.
You have created an application and deployed it for the first time in the EDAS console.
For more information about how to create an application in an ECS cluster, see Create and deploy an application in an ECS cluster.
For more information about how to create an application in a Container Service for Kubernetes (K8s) cluster, see Create an application in a Container Service cluster.
Automate application deployment
Add the following plugin dependency to the pom.xml file of your project.
<build> <plugins> <plugin> <groupId>com.alibaba.cloud</groupId> <artifactId>toolkit-maven-plugin</artifactId> <version>1.0.3</version> </plugin> </plugins> </build>NoteYou can obtain the latest version of this plugin from the official Maven Central Repository.
In the project directory, create a YAML file named
.edas_config.yaml.NoteIf the project that you want to deploy is a Maven submodule, create this file in the directory of the submodule.
The following configuration parameters are examples. You must replace them with your actual application parameters. For more information about configuration parameters, such as batch deployment, see Configuration items.
For more information about how to deploy multi-module projects, see Deploy multi-module projects.
env: region_id: cn-beijing # The region ID of the application instance app: app_id: eb20****-e6ee-4f6d-a36f-5f6a5455**** # The ID of the application that you want to deployIf you do not know the values for these parameters, follow these steps to retrieve them:
Log on to the EDAS console. In the upper-left corner of the page, select the region that you want.
In the navigation pane on the left, choose . On the Application List page, click the name of the application that you want to deploy.
On the Basic Information page, click Deploy Application in the upper-right corner.
On the Select Deployment Mode page, find the Regular Release (Single/Multi-batch) Start Deployment card and click Start Deployment in the upper-right corner of the card.
Click Generate Maven Plugin Configuration to expand the section and view the parameter information.

In any directory, create a YAML account file and add your AccessKey ID and AccessKey secret to the file.
access_key_id:<yourAccessKeyId> access_key_secret:<yourAccessKeySecret>NoteThe AccessKey ID and AccessKey secret in this configuration are used only to generate request signatures. They are not used for other purposes, such as network transmission.
To view your AccessKey ID and AccessKey secret, log on to the Alibaba Cloud User Information Management page. We recommend that you use a Resource Access Management (RAM) user that has Application Management permissions to control application permissions and improve application security.
Navigate to your project directory and run the following packaging command.
NoteIf you are using a multi-module Maven project, navigate to the directory of the submodule.
mvn clean package toolkit:deploy -Daccess_key_file={path_to_your_account_file}toolkit:deploy: Deploys the application using the toolkit-maven-plugin after the application is packaged. The application is deployed only if you add this parameter.
access_key_file: The path to the Alibaba Cloud account file. For more information about how to specify a key pair, see Account configuration and priority.
Verify the result
After you run the command, logs are displayed in the terminal. If the following log output is displayed, the deployment is successful.
Deploy multi-module projects
Multi-module projects use a common project structure. This Maven plugin supports the following two methods for deploying multi-module projects.
Run the packaging and deployment commands in the parent project: When you run the
toolkit:deploycommand in the parent project, add the-Ddeploy_artifactsparameter to specify the artifact IDs of the submodules that you want to deploy. To deploy multiple submodules, separate the artifact IDs with a comma.For example, a CarShop project contains the following submodules:
carshop itemcenter-api itemcenter detailTo deploy the itemcenter and detail submodules at the same time, run the following command in the carshop directory:
mvn clean package toolkit:deploy -Ddeploy_artifacts=itemcenter,detailBy default, this plugin deploys the corresponding applications based on the
.edas_config.yamlfiles in the itemcenter and detail modules. You can also add the-Dedas_configparameter to specify a configuration file. For more information, see Specify a configuration file.ImportantThis method requires toolkit-maven-plugin version 1.0.3 or later.
Run the packaging and deployment commands in a submodule:
In the parent project, run the
installcommand to install the submodule dependencies to the local Maven repository.Navigate to the directory of the submodule that you want to deploy and run the
toolkit:deploycommand.
NoteThis method is supported by all versions of toolkit-maven-plugin.
More information
For more information about configuration items, how to specify a configuration file, and account configuration and priority, see Maven deployment instructions.