All Products
Search
Document Center

Use IntelliJ IDEA to quickly deploy applications

Last Updated: Feb 02, 2019

Alibaba Cloud Toolkit for IntelliJ IDEA (hereinafter referred to as Cloud Toolkit) is a free IDE plugin that helps users use Alibaba Cloud more efficiently.

You can register or use an existing Alibaba Cloud account to download Cloud Toolkit for free.After downloading Cloud Toolkit, you can install it in IntelliJ IDEA.

After developing, debugging, and testing an application locally, you can use Cloud Toolkit to easily deploy the application to Alibaba Cloud.Currently, you can use Cloud Toolkit to deploy applications to ECS instances, EDAS, and Container Service for Kubernetes.

This topic describes how to install Cloud Toolkit to IntelliJ IDEA and use it to quickly deploy an application to EDAS.

Prerequisites

Install Cloud Toolkit

  1. Run IntelliJ IDEA.

  2. Install Cloud Toolkit to IntelliJ IDEA.

    • Mac system: On the Preference page, click Plugins in the left-side navigation pane. In the search box on the right, enter Alibaba Cloud Toolkit, and click Install.

       Configure parameters to install Cloud Toolkit

    • Windows system: Click Plugins. In the search box, enter Alibaba Cloud Toolkit, and click Install.

       Configure parameters to install Cloud Toolkit

  3. After the Cloud Toolkit is successfully installed to IntelliJ IDEA, restart IntelliJ IDEA. The Alibaba Cloud Toolkit icon is displayed in the toolbar.).

Configure a Cloud Toolkit account

To configure a Cloud Toolkit account, you must have an Access Key ID and an Access Key Secret.

  1. Run IntelliJ IDEA.

  2. Click the Alibaba Cloud Toolkit icon (), and click Preference… in the drop-down list to go to the Settings page. In the left-side navigation pane, choose Alibaba Cloud Toolkit > Accounts.

  3. On the Accounts page, set Access Key ID and Access Key Secret, and click OK.

     Configure an Alibaba Cloud Toolkit account

    • If you have an Alibaba Cloud account, on the Accounts page, click Get Existing AK/SK to go to the logon page of Alibaba Cloud.Log on to the Alibaba Cloud console. Go to the Security Management page to retrieve your Access Key ID and Access Key Secret.

    • If you do not have an Alibaba Cloud account, on the Accounts page, click Sign up to go to the registration page of Alibaba Cloud. Register an Alibaba Cloud account on this page.Then, retrieve your Access Key ID and Access Key Secret using the preceding method.

Deploy applications to EDAS

Currently, you can use Cloud Toolkit to deploy applications to EDAS with WAR or JAR packages.

  1. On IntelliJ IDEA, click the Alibaba Cloud Toolkit icon (). In the drop-down list, click EDAS on Alibaba Cloud.

  2. On the Deploy to EDAS page, configure the application deployment parameters.Then, click Apply to save the settings.

     Deploy applications

    1. On the configuration page, select Region, Namespace, Application, and Group as needed.
      • Region: indicates the region where your application is located.
      • Namespace: indicates the namespace where your application is located.
      • Application: indicates the name of your application.
      • Group: indicates the group to which your application belongs.
    2. Sets the build mode.
      • Maven Build: When you select the Maven Build mode to build applications, a Maven task is added by default to build the deployment package.
      • Upload File: When you select the Upload File mode to build applications, upload WAR or JAR packages to deploy the applications.

    Note: If you have not created an application in EDAS, click Create application on EDAS console… in the upper-right corner of the dialog box to go to the EDAS console. Then, create an application.For more information about how to create applications, see Deploy Java applications in ECS clusters.

  3. Click Run to run the configuration completed in the preceding step. Deployment logs are printed in the IntelliJ IDEA Console area.You can check the deployment result based on the logs.

Manage Maven tasks

In Cloud Toolkit installed in IntelliJ IDEA, you can deploy Maven tasks.Additionally, you can add, delete, modify, and move Maven tasks in the Before launch area of the Deploy to EDAS page.

 Manage Maven build tasks

In the Select Maven Goal dialog box, click the folder button on the right of Working directory and select all available modules for the current project. Enter the building command in Command line.

 Maven task edit box

Deploy multi-module projects

Most of Maven projects involve multiple modules. These modules can be developed separately and some of them may use the functions of other modules. This type of project is a multi-module project.

If your project is a Maven multi-module project and you want to deploy a submodule in the project, make sure that the last Maven task in the Before launch area of the EDAS Deployment Configurations page is built for the submodule.(For more information about how to manage Maven build tasks, see the Manage Maven build tasks section.)

For example, the current CarShop project has the following submodules:

  • carshop
    • itemcenter-api
    • itemcenter
    • detail

where itemcenter and detail are two submodules and depend on the itemcenter-api module. In this case, how is the itemcenter submodule deployed?In the Before launch area of the EDAS Deployment Configurations page, add the following two Maven tasks:

  1. Add a Maven task to run the mvn clean install command in the carshop parent project.
  2. Add a Maven task to run the mvn clean package command in the itemcenter submodule.

Note: Make sure that the Maven task for the itemcenter submodule is the last task in the Before launch area.