String remoteEarFile = remotePath + "/" + project.getArtifact().getArtifactId() + CommandUtils.SUFFIXE_EAR;
String remoteXmlFile = remotePath + "/" + project.getArtifact().getArtifactId() + CommandUtils.SUFFIXE_XML;
SSHClientUtils sshclient = new SSHClientUtils(hostServer, hostUser, hostPassword, logger);
logger.info("Creating directory " + remotePath + " ...");
sshclient.sendShell("mkdir -p " + remotePath, remoteDirectory);
logger.info("Moving " + localEarFile + " to " + remoteEarFile + " ...");
sshclient.sendFile(localEarFile, remoteEarFile);
logger.info("Moving " + localXmlFile + " to " + remoteXmlFile + " ...");
sshclient.sendFile(localXmlFile, remoteXmlFile);
StringBuilder commandDeploy = new StringBuilder();
commandDeploy.append(CommandUtils.getRemoteAppManageBin()).append(" -deploy");
commandDeploy.append(" -ear ").append(remoteEarFile);
commandDeploy.append(" -deployconfig ").append(remoteXmlFile);
commandDeploy.append(" -app ").append(appTibco);
commandDeploy.append(" -domain ").append(tibcoDomain);
commandDeploy.append(" -user ").append(tibcoUser);
commandDeploy.append(" -pw ").append(tibcoPassword);
logger.info("Executing " + commandDeploy.toString() + " ...");
sshclient.sendShell(commandDeploy.toString(), remoteDirectory);
} catch (Exception e) {
e.printStackTrace();
throw new MojoExecutionException("Error in deploying ear ..." + e.getMessage());
}