始めます
あなたに必要な最初のステップ:サービスは、開発サーバの一般的な手順に配備されwar
、袋(または他の)scp
サーバー上の指定した場所に、特定介してサービスの第2ステップshell命令
の手順の展開。
jenkins
上記の処理ステップは完璧なことができ、我々はしていないjenkins
ことへの他の軽量なアプローチを持っていますか?
また、対応する二つのステップ:最初のステップは、自動化されていことができなければならないscp
ツール。第二段階は、リモートスクリプトを実行するためのツールを自動化しました。この2つのステップがに統合することができた場合はIDEA
、ボタンになっ操作、それは非常に快適です。
ツール
SCPツール
まず、考慮に入れることはscpコマンドを使用することでlinux
、直接使用することができる環境を組み込みのscp
コマンド、Windows
環境もオンライン対応はありscp.exe
ますが、パスワードソリューション、高い導入コストを入力する一切既製の自動コマンドラインがありません。
活用しないのはなぜjava
クロスプラットフォーム手書きの特徴scp.jar
、それを?
彼は先に行ってきました
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
非常にシンプルなscp
ツールが生まれた、それが含まれているscp
次のようにコマンドを実行するのに必要な基本的なパラメータを:
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"
シェルのexecツール
リモート実行shell
共感のツールコマンド。
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
これら2つのツールを使用すると、残りはに統合されていますIDEA
。
- 設定ジャー
Edit Configurations -> new Configuration -> JAR Application
2. [設定scp.jar
3.同様に構成されたシェルexec.jar
4.新しい構成の構築Edit Configurations -> new Configuration -> Compound
、この2つのステップの合成ステップ動作の
追加compound
組み合わせた2つの段階
- 設定が完了すると、
Run it!
コンソールビュー
ます。https://www.jianshu.com/p/e6cf392347d3で再現