ensure to run setDomainEnv.sh/setDomainE
nv.cmd which is located in bin directory of your domain.
Create a build.xml file which will have the follwoing targets.
action="deploy" verbose="true" debug="true"
name="DeployExample" source="output/redeployEAR"
user="weblogic" password="weblogic"
adminurl="t3://localhost:7001" targets="myserver" />
action="undeploy" verbose="true" debug="true"
name="DeployExample"
user="weblogic" password="weblogic"
adminurl="t3://localhost:7001" targets="myserver"
failonerror="false" />
Now you can run, "ant deploy" or "ant undeploy"
Note that "myserver" mentioned about can be replaced with your cluster name or managed server name (according to your needs).
Refer
http://e-docs.bea.com/wls/docs90/programming/wldeploy.html#1000506 for more details