WebSphere – WsAnt Scripts to Updating Applications

This example shows an example on using WsAnt tasks to automate WebSphere application updates instead of manually doing the same build/deploy all the time.

This article is written for WebSphere Portal/Application Server 8

When starting off with WebSphere application development,
installation usually takes place in the WebSphere Portal Administration pages (WAR installations),
or in the Administration Console (everything else).

However, every time it requires a manual install/update through a series of wizard forms and it could be time consuming. Instead we will be leveraging WsAnt tasks, that allow us to script an update task for our application. It will speed up your deployment process and it can be used in your automation plans later on.

The following example assumes the following:

  • A single server WPS installation on a Linux Environment
  • An account with admin rights: admin/admin
  • AppName: my-test-application
  • Built EAR: my-test-application.ear
  • File built in the following directory: /home/username/transfers
  • Cell: defaultCell
  • Node: defaultNode

The following list are setup as properties so that they can be referred from the various tasks below.
Either save the below example as an xml.

e.g. deployMyTestApplication.xml

Afterwards, you need to create another shell script to execute the WsAnt task with the xml file above as an argument:

In your favorite editor, create a shell script, e.g. updateMyTestApplication.sh, with the following call:

Once the xml file and the shell scripts are created, just one more command, to update your shell script to ensure you can execute it:

This is it, assuming you are in the directory with all the shell script, just execute it with a call to the script, and you will most likely be prompted for the admin password.

For more information about the WsAnt Tasks, please refer to the following IBM Documentation

IBM Knowledge Center – Using Ant to Automate Tasks



Leave a Reply

Your email address will not be published. Required fields are marked *