Start
The service is deployed to the development server general steps: The first step you need to your war
bag (or other) scp
to the specified location on the server; the second step in the service through certain shell命令
steps deployment.
jenkins
The above processing steps can be perfect, we do not jenkins
have other lightweight approach to it?
Also the corresponding two steps: The first step must be able to have automated scp
tools. The second step has automated tools to perform remote scripts. If these two steps can be integrated into IDEA
the operation turned into a button, it is very comfortable.
tool
scp tool
First, take into account is to use scp command linux
environment can directly use the built-in scp
command, Windows
the 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 java
cross-platform features a hand-written scp.jar
it?
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 scp
tool was born, it contains scp
basic 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 shell
tool 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 IDEA
the.
- Configuration jar
Edit Configurations -> new Configuration -> JAR Application
2. Configure scp.jar
3. Similarly configured shell-exec.jar
4. Construction of the new configuration Edit Configurations -> new Configuration -> Compound
, these two steps synthesis step operation
Addcompound
The combined two steps
- Once configured,
Run it!
Console View
Reproduced in: https: //www.jianshu.com/p/e6cf392347d3