IDEA one-click deployment to the development server

Start

The service is deployed to the development server general steps: The first step you need to your warbag (or other) scpto the specified location on the server; the second step in the service through certain shell命令steps deployment.

jenkinsThe above processing steps can be perfect, we do not jenkinshave other lightweight approach to it?

Also the corresponding two steps: The first step must be able to have automated scptools. The second step has automated tools to perform remote scripts. If these two steps can be integrated into IDEAthe operation turned into a button, it is very comfortable.

tool

scp tool

First, take into account is to use scp command linuxenvironment can directly use the built-in scpcommand, Windowsthe environment also has a corresponding online scp.exe, but there is no ready-made automatic command line to enter a password solutions, high deployment costs.

Why not take advantage of javacross-platform features a hand-written scp.jarit?

He went ahead

https://gitee.com/zkdcloud.cn/scp/releases

java -jar .\scp-1.0.0.jar -help

usage: scp -help
 -d,--dst_path <arg>   the dstPath of remote
 -h,--host <arg>       the host of remote server
 -help                 usage help
 -P,--port <arg>       the port of remote server
 -p,--password <arg>   the password of remote server
 -s,--src_path <arg>   the srcPath of local
 -u,--user <arg>       the user of remote server

Very simple scptool was born, it contains scpbasic parameters required to execute the command as follows:

java -jar .\scp-1.0.0.jar -s "D:\abc-project\target\abc.war" -h "192.168.27.112" -u "root" -p "111111" -d "/tmp/abc.war"

shell-exec tool

Remote execution shelltool command of empathy.

https://gitee.com/zkdcloud.cn/shell-exec/releases

java -jar .\shell-exec-1.0.0.jar -help
Missing required options: h, u, p, c
usage: scp -help
 -c,--command <arg>    will exec command
 -h,--host <hello>     the host of remote server
 -help                 usage help
 -P,--port <arg>       the port of remote server
 -p,--password <arg>   the password of remote server
 -u,--user <arg>       the user of remote server
java -jar .\shell-exec-1.0.0.jar -c "mv /tmp/abc.war /home/tomcat/webapps/ && /home/tomcat/bin/startup.sh" -h 192.168.27.112 -u root -p 111111

IDEA on a key deployment

With these two tools, the rest is integrated into IDEAthe.

  1. Configuration jar Edit Configurations -> new Configuration -> JAR Application
3432069-3b9bb2968c68f3e2.jpg
image

2. Configure scp.jar


3432069-189b6c84fe003258.jpg
image

3. Similarly configured shell-exec.jar

4. Construction of the new configuration Edit Configurations -> new Configuration -> Compound, these two steps synthesis step operation
Addcompound

3432069-78202a758bd9253f.jpg
image

The combined two steps


3432069-d8e9f7968b18c2f2.jpg
image
  1. Once configured, Run it!
3432069-7929c2887f3dea78.jpg
image

Console View


3432069-5dff6dff7eb75ed6.jpg
image

Reproduced in: https: //www.jianshu.com/p/e6cf392347d3

Guess you like

Origin blog.csdn.net/weixin_33873846/article/details/91181648