All operations in this paper are based on Alibaba Cloud Toolkit.

1. Install the plug-in

Download and install it from the plugin marketplace.

  1. Select File>Settings from the top menu bar of IntelliJ IDEA.

  2. Click Plugins in the left navigation bar of the Settings dialog.

  3. Click Marketplace in the Plugins area.

  4. Enter Alibaba Cloud Toolkit in the search box.

  5. Alibaba Cloud Toolkit appears in the Search Results area. Click Install.

  6. After the download and installation is complete, click Restart IDE.

  7. Fill in the Invitation code

Invitation code: 6ERULV

2. Configure the server ADDRESS

Add a server.

  1. Choose Tools>Alibaba Cloud>Alibaba Cloud View>Host from the menu bar at the top of IntelliJ IDEA.
  2. On the Host TAB page, click Add Host.

 

3. In the Add Host dialog box, set Host List, Username, Password, and Tag, and click Add.

  

After setting the parameters, you can click Test Connection to Test whether the Connection to the server is successful.

3. Deploy applications

  1. Choose Alibaba Cloud>Deploy to Host from the top menu of IntelliJ IDEA… .
  2. Set deployment parameters in the Deploy to Host dialog box, and then click Run.

The following table describes the deployment parameters:

parameter

describe

File

  • Maven Build: If the current project is built using Maven, you can directly Build and deploy the project.
  • Upload File: If the current project is not built using Maven or a package deployment File already exists on the local PC, select and Upload the local deployment File.
  • Gradle Build: If the current project is built using Gradle, select this option to Build and deploy.

Target Host

Select a Tag from the drop-down list, and then select the server to deploy from that Tag.

Target Directory

Enter the deployment path on the server, for example, /root/tomcat/webapps.

Command

Enter the application startup command, for example, sh /root/restart.sh.

3. If the following figure is displayed, the file is being uploaded

Indicates that the upload is complete

In the attached a start | restart script

#! Jar # JVM=" -server-xms2g -xmx2g -xmn512m -xx :PermSize=128M -XX:MaxNewSize=128m -XX:MaxPermSize=25zh6m -Xss256k -Djava.awt.headless=true -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -Xloggc:/logs/xxx-server/GC/xxx-gc.log" # APPFILE_PATH = "- Dspring. Config. Location = / usr/local/config/application properties" # instructions, used to prompt the input parameters the usage () {echo "the usage: Sh script execution. Sh [start | stop | restart | status | wire | backup] "exit 1} # to check whether the program is running is_exist () {pid = ` ps - ef | grep $APP_NAME | grep -v Grep | awk '{print $2}' ` # 1 if there is no return, there returns 0 if [-z "${pid}"]. Then return 1 else return 0 start(){is_exist if [$? -eq "0"]; then echo "${APP_NAME} is already running. pid=${pid} ." else #nohup java $JVM -jar $APPFILE_PATH $APP_NAME > /dev/null 2>&1 # start the jar package in the background, and control the environment variables, according to the actual situation. Nohup Java $JVM -jar $APP_NAME --spring.profiles. Active =prod > /dev/null 2>&1 &fi} # stop(){is_exist if [$? -eq "0"]; Then kill -9 $PID else echo "${APP_NAME} is not running" fi} # is_exist if [$? -eq "0"]; Then echo "${APP_NAME} is running. Pid is ${Pid}" else echo "${APP_NAME} is NOT running. fi} # restart(){stop start } # log(){tail -n 100 -f /logs/ fdC-server/fdC-server.log} # backup(){ BACKUP_PATH = / usr/local/webapps/backup/XXX - server / # for the current time as a backup file name BACKUP_DATE = ` date + "% Y % m % d (m H % : % : % S)" ` echo 'backup -r /usr/local/webapps/$APP_NAME $BACKUP_PATH$BACKUP_DATE'. Jar '} Case "$1" in "start") start;; "stop") stop ;; "status") status ;; "restart") restart ;; "log") log ;; "backup") backup ;; *) usage ;; esacCopy the code