Welcome to search “little monkey technical notes” to follow my public account, you can timely communicate with me if you have any questions.
Most of the time we need to publish jar package to the server after compiling -> package -> upload package to the server -> start jar package and a series of operations. Although the operation is very simple, it is still more troublesome to repeatedly change the packet frequently, repeating many simple and useless actions.
Here we recommend a plugin for IDEA, called “Alibaba Cloud Toolkit”, which can publish and run remote servers such as JAR packages with one click. Wouldn’t it be convenient to post projects with one click? Let’s see how to configure this plug-in!
1. Open the IDEA development tool and select File to find Settings.2. Then search for “plugins” in the search box to find “Marketplace”.3. Enter Alibaba Cloud Toolkit and click Install to install it.4. After the installation is complete, click “OK” and it will prompt you to restart IDEA. Then click “restart”.
5. Re-enter idea and there will be a prompt. If there is the following prompt, the installation is successful, and then click “Close”.6. Find “Alibaba Cloud View” in the bottom bar of IDEA tool to configure the host.7. Click Add Host to add a host.8. Set host list to the host IP address. Set username to the username and password to the password.Of course, you can also choose the private key to connect.9. Click “Test Connection” to test the connection. If “OK” appears, the configuration is successful.At this point, the basic configuration is complete. Next I will simulate the effect of a SpringBoot project automatically compiling a package, uploading it and running it.
@RestController public class ToolController { @GetMapping("test") public String test(String msg) { return "hello: " + msg; }}Copy the code
Write a simple boot project, enter a MSG and prompt, the effect is as follows:Next, I will publish this project on my Aliyun. First select Tool to find “deploy to Host”!And then I’m going to set the name, you can set that arbitrarily. Then select the IP address you set earlier.
I can select multiple IP addresses, so I only have one IP address, and then click “Select”.Then you need to set the JAR package to upload to that Directory, the Directory of the remote host, in “Target Directory”. Once set, you can select a script to operate on the JAR. Select “Select Command”.If you have not written a command before, select Add Command to add a command.Here write a background run jar package command.You can also select what maven needs to do before running these commands, that is, what maven needs to do before uploading the package. You can select the project and select the Fill in Maven command.
Then click “Apply”, and if you click “OK”, the command will be executed directly. If you don’t want to execute directly, just click “Apply”.If you confirm that there is no problem with the configuration, you can first select the previously configured project, and then click the green triangle to run, and then pay attention to the console.The first is the maven command result. “BUILD SUCCESS” indicates that the previous command was successful.The second is the result of uploading the JAR package and the result of executing the command after uploading.Open a browser to access:Summary: This is a very powerful plug-in, can save a lot of redundant labor. But today’s introduction is only the tip of the iceberg, here we recommend you can go to the official website to find more treasures.
Alibaba Cloud Toolkit’s official website: help.aliyun.com/product/299…