|
|
|
@ -117,6 +117,14 @@ public class Deploy extends AbstractMojo {
|
|
|
|
sh = StrUtil.replace(sh, "{1}", targetFile);
|
|
|
|
sh = StrUtil.replace(sh, "{1}", targetFile);
|
|
|
|
sh = StrUtil.replace(sh, "{2}", server.getDeployActive());
|
|
|
|
sh = StrUtil.replace(sh, "{2}", server.getDeployActive());
|
|
|
|
sh = StrUtil.replace(sh, "{3}", server.getDeployPort());
|
|
|
|
sh = StrUtil.replace(sh, "{3}", server.getDeployPort());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String appArgStr = "";
|
|
|
|
|
|
|
|
if (server.getAppArgs() != null && server.getAppArgs().length > 0) {
|
|
|
|
|
|
|
|
appArgStr = String.join(" ", server.getAppArgs());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sh = StrUtil.replace(sh, "{4}", appArgStr);
|
|
|
|
|
|
|
|
sh = StrUtil.replace(sh, "{5}", String.valueOf(server.isLibSeparated()));
|
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(server.getDeployActive())) {
|
|
|
|
if (StrUtil.isNotBlank(server.getDeployActive())) {
|
|
|
|
client.write(serverPath + "/service-" + server.getDeployActive() + ".sh", sh);
|
|
|
|
client.write(serverPath + "/service-" + server.getDeployActive() + ".sh", sh);
|
|
|
|
client.exec("chmod +x {}", serverPath + "/service-" + server.getDeployActive() + ".sh");
|
|
|
|
client.exec("chmod +x {}", serverPath + "/service-" + server.getDeployActive() + ".sh");
|
|
|
|
@ -180,6 +188,17 @@ public class Deploy extends AbstractMojo {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
printLog(StrUtil.format("upload package {}", "finish"));
|
|
|
|
printLog(StrUtil.format("upload package {}", "finish"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (server.isLibSeparated()) {
|
|
|
|
|
|
|
|
File libDir = new File(targetPath, "lib");
|
|
|
|
|
|
|
|
if (libDir.exists() && libDir.isDirectory()) {
|
|
|
|
|
|
|
|
printLog("start upload lib directory");
|
|
|
|
|
|
|
|
client.putFiles(libDir.getAbsolutePath(), serverPath + "/lib");
|
|
|
|
|
|
|
|
printLog("upload lib directory finish");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
printLog("[WARN] lib directory not found: {}, skip lib upload", libDir.getAbsolutePath());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
printLog("stop service {}", server.getName());
|
|
|
|
printLog("stop service {}", server.getName());
|
|
|
|
client.exec("systemctl stop {}.service", server.getName());
|
|
|
|
client.exec("systemctl stop {}.service", server.getName());
|
|
|
|
|
|
|
|
|
|
|
|
|