A small WLST script to enable remote deployment of applications on WebLogic. The script will check for old versions, and undeploy the oldest if more than one is found (WLS supports two deployed versions at the same time).
All variables shown between < and > signs must be replaced by real values:
import re warPath = '<location of war/ear>' connect('<user - weblogic>', '<password>', '<server-url>') appList = re.findall('<app name>#(\d*)', ls('/AppDeployments')) if len(appList) > 1: oldestArchiveVersion = min(map(int, appList)) undeploy('<app name>', archiveVersion = oldestArchiveVersion) deploy('<app name>', path = warPath, retireTimeout = 0, upload = 'True') exit()
To run first set up the paths to enable WLST (typically calling the
setWLSEnv.cmd/sh script) and then run
'java weblogic.WLST deploy.py'.