Welcome to search “little monkey’s technical notes” to pay attention to my public number, you can communicate with me in time.
A lot of times we publish the JAR package to the server side need to go through a series of operations, such as compile -> package -> upload the package to the server -> launch the JAR package. Although the operation is very simple, it is still troublesome to repeat the change of package frequently and repeat a lot of simple and useless actions.
Here we recommend an IDEA plugin, called “Alibaba Cloud Toolkit”, which can publish and run remote servers such as JARs with one click. Is it convenient to post projects in the future with just one click? Now let’s see how to configure the plug-in!
1. First open the IDEA development tool and select “File” to find “Settings”.
2. Then search “Plugins” in the search box to find “Marketplace”.
3. Enter “Alibaba Cloud Toolkit” and click “Install” to install.
4. After the installation is complete, click “OK” and you will be prompted to restart Idea. Then click “Restart” and you will be done.
5. There will be a prompt when you re-enter IDEA. The following prompt indicates that 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 the host.
8. Configure “host list” to represent the host IP, enter “username” : username and “password” : password.
You can also select a private key to connect.
9. Then click “Test Connection” to test the connection. If “OK” appears, the configuration is successful.
At this point, the basic configuration is complete. Next, I’ll simulate what a SpringBoot project would look like when it is automatically compiled, packaged, uploaded and run.
@RestController public class ToolController { @GetMapping("test") public String test(String msg) { return "hello: " + msg; }}
I wrote a simple boot project, type a MSG and prompt, the effect is as follows:
Next, I will post this project to my Ali Cloud. First select Tool and find “Deploy to Host”!
And then you can set the name, which you can set whatever you want. Then select the IP set previously.
You can select multiple IP addresses, so far I only have one IP address, select it and click “Select”.
Then you need to set the JAR to be uploaded to the Directory, which is the Directory of the remote host, in the “Target Directory”. Once set up, you can select a script to operate on the JAR. So select command.
If you haven’t written a command before, you can select “Add Command” to add a command.
Here I write a command to run the JAR package in the background.
You can also choose what to do with Maven before you run these commands, that is, what Maven needs to do before you upload a package, you can select that project, and you can choose to fill in the Maven command.
Then click “Apply”. If you click “OK”, the command will be executed directly. If you don’t want to do it directly, just click “Apply”.
After confirming that there is no problem with the configuration, you can select the previously configured project first, and then click the green triangle to run, and then pay attention to the console.
There are two columns of prompts in the console. The first is the result of the Maven command. Seeing “Build Success” indicates that the previously set command has succeeded.
The second is the result of uploading the JAR package and the result of executing the command after uploading.
Open a browser to access:
Conclusion: This is a very powerful plug-in, can save a lot of repetitive labor. But today’s introduction is just the tip of the iceberg, I recommend you can go to the website to find more treasures.
Alibaba Cloud Toolkit’s official website: https://help.aliyun.com/produ…
Welcome to search “little monkey’s technical notes” to pay attention to my public number, you can communicate with me in time.