Deploy applications to a Linux server using IntelliJ IDEA

更新时间:
复制 MD 格式

Cloud Toolkit supports deploying applications to servers that use the standard Secure Shell (SSH) protocol. You can quickly deploy applications by selecting a target server in the graphical user interface without having to switch between different tools. This topic describes how to deploy a local application to a Linux server using Cloud Toolkit in IntelliJ IDEA.

Prerequisites

Deploy an application to a Linux server

You can deploy a local application. The steps are as follows:

  1. Import your local application into IntelliJ IDEA.

  2. Add a server.

    1. In the IntelliJ IDEA menu bar, choose Tools > Alibaba Cloud > Alibaba Cloud View > Host.

    2. On the Host tab, click Add Host.

    3. In the Add Host dialog box, set parameters such as Host List, Username, and Password, and then click Add.

      Note

      After you set the parameters, you can click Test Connection to verify the connection to the server.

  3. Deploy the application.

    1. In the IntelliJ IDEA menu bar, choose Alibaba Cloud > Deploy to Host....

    2. In the Deploy to Host dialog box, set the deployment parameters and then click Run.

      The following table describes the deployment parameters.

      Parameter

      Description

      File

      • Maven Build: If the current project is a Maven project, you can build and deploy it directly.

      • Upload File: If the current project is not a Maven project, or if a packaged deployment file already exists on your computer, select and upload the local deployment file.

      • Gradle Build: If the current project is a Gradle project, select this option to build and deploy it.

      Target Host

      From the drop-down list, select a tag, and then select the server where you want to deploy the application.

      Target Directory

      Enter the deployment path on the server, such as /root/tomcat/webapps.

      Command

      Enter the application start command, such as sh /root/restart.sh.

Result Verification

After the deployment starts, the Console pane in IntelliJ IDEA displays the deployment logs. You can check the deployment result based on the log information.

You can also log on to the remote server using the built-in terminal. After you log on, use the cd command to go to the deployment path and then run the ls command to check if the deployment was successful. To log on to the remote server, perform the following steps:

  1. At the bottom of the IntelliJ IDEA editor, click the Alibaba Cloud View tab, and then click the Host tab.

  2. On the Host tab, click Terminal in the Actions column for the target remote server to log on to the server.

For more information about how to view application deployment logs, see Use Cloud Toolkit to view daily rolling log files on a remote server.