if (null == targets) {
throw new IllegalStateException("No target to distribute to");
}
targets = new Target[] {targets[0]};
ProgressObject po;
if (DeployUtils.isJarFile(file) || file.isDirectory()) {
po = mgr.distribute(targets, file, null);
} else {
po = mgr.distribute(targets, null, file);
}
waitForProgress(po);
if (po.getDeploymentStatus().isCompleted()) {
modules = po.getResultTargetModuleIDs();
po = mgr.start(modules);
waitForProgress(po);
if (po.getDeploymentStatus().isCompleted()) {
completed = true;
} else {
log.warn("Unable to start some modules for " + file.getAbsolutePath());
}
modules = po.getResultTargetModuleIDs();
for (int i = 0; i < modules.length; i++) {
TargetModuleID result = modules[i];
log.info(DeployUtils.reformat("Deployed " + result.getModuleID() + (targets.length > 1 ? " to " + result.getTarget().getName() : "") + (result.getWebURL() == null ? "" : " @ " + result.getWebURL()), 4, 72));
if (result.getChildTargetModuleID() != null) {
for (int j = 0; j < result.getChildTargetModuleID().length; j++) {
TargetModuleID child = result.getChildTargetModuleID()[j];
log.info(DeployUtils.reformat(" `-> " + child.getModuleID() + (child.getWebURL() == null ? "" : " @ " + child.getWebURL()), 4, 72));
}
}
}
} else {
//Try to delete the module , that failed to successfully hot-deploy
log.error("Unable to deploy: " + po.getDeploymentStatus().getMessage());
String delfile=file.getAbsolutePath();
File fd = new File(delfile);
if(fd.isDirectory()){
log.info("Deleting the Directory: "+delfile);
if(DeploymentUtil.recursiveDelete(fd))