Attached patch, and changing fix version to 1.2. Also unassigning so that committers can review and update.
In CommandDistribute, before deploying and application check if the application with same targetID exists. If it exists instead of distributing and starting, redeploy it.
Added private method checkExisting() to find if the application is already deployed.. This code requires to use getCommand() method of DeployTool.java which was private, made it public for command redirection.
Shoule we eliminate redeploy altogether as deploy will anyway redeploy whereever necessary!!
We can if we want to it, but I think this need to be decided by community.
I think we should retain both deploy and redeploy commands as they are right now and provide an "override" option so that deploy command redeploys and redeploy command deploys if necessary.
Moving to 2.0.x
I think deploy tool should throw an error when trying to deploy to an existing configuration.
redeploy command should be used so user is sure what he's doing.
moreover, undeploy and deploy should do it too.
but should never redeploy an application, IMHO
When an app is undeployed (as part of a redeploy) any other apps that depend on it are stopped.
Trying to track down all apps that depend on the current app so that they can be automatically restarted is too much effort to expend in the 2.0.x branch.
If there is sufficient interest - a new JIRA should be opened in a more current/active branch.