Automating portlet deployment on WebSphere Portal using Apache Maven

If you download sample code from my blog you will notice that i use Apache Maven as build tool, my source code is structured in Maven format and you will find a pom.xml file which is maven build script.

I like to make my development environment as simple as possible and automate deployment so that i can test my changes rapidly. So i did create this very basic approach for automating deployment of portlet to WebSphere Portal using xmlaccess + maven. This approach is very similar to how you can automate deployment of portlet to Apache Pluto. You can download sample AjaxPortlet from here

I follow these steps whenever i create a new project

  • I create a simple portlet.xml that does not have any id portlet application id like this

    <?xml version="1.0" encoding="UTF-8"?>
    <portlet-app xmlns=""
    version="2.0" xmlns:xsi=""
    <display-name>Ajax Portlet</display-name>
    <title>Ajax Portlet</title>
    <short-title>Ajax Portlet</short-title>
    <keywords>Ajax Portlet</keywords>

    The value of portlet-name is important for deployment

  • Then i create a pom.xml file which is build script for for my portlet and has custom integration-test target that i use for deploying portlet

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns=""

    <!-- Change this to something akin to your java package structure -->
    <!-- Version of this app -->
    <!-- Base name of the war file without .war ext -->
    <!-- Dependency Version Properties ======================================= -->
    <xmlaccess.path>/software/work/blog/performance/ajax/AjaxPortlet /UpdatePortlet.xml</xmlaccess.path>

    <scope>provided</scope><!-- Prevents addition to war file -->


    <property environment="env"/>
    <exec executable="/bin/bash" dir="${wps.home}/PortalServer/bin">
    <arg line=" -user ${} -password $
    {wps.admin.password} -url ${wps.url} -in ${xmlaccess.path}"/>

    In this file you will have to set properties for following things

    • wps.home: Location of portal installation base on your machine

    • wps.url: Config URL for xmlaccess for your portal server it will be http://localhost:10040/wps/config by default

    • User name for WPS admin

    • wps.admin.password: Password for WPS admin

    • xmlaccess.path: Path of UpdatePortlet.xml, which is a xmlaccess file that i use for deploying my portlets

    In most of the cases when i create a new portlet only value that will change is xmlaccess.path to point to new updateportlet.xml which is already always in the same directory as that of pom.xml, i bet i can read that directory name using Apache Maven variable but i will have to get some time to find that out

    In my script i have a integration-test target which makes use of ant to execute xmlaccess script that updates the portlet, this ant script gets executed when i execute mvn integration-test

  • The final step is to create a UpdatePortlet.xml file like this

    <?xml version="1.0" encoding="UTF-8"?>

    <!-- sample for updating a portlet from a new version of the WAR file -->
    <portal action="locate">

    <web-app action="update" active="true" uid="AjaxPortlet.war.webmod">
    <portlet-app action="update" active="true" uid="AjaxPortlet.war">
    <portlet action="update" active="true" objectid="thePortlet" name="AjaxPortlet">


    The UpdatePortlet.xml file needs information such as location of .war file, PortletName that i can get portlet.xml, .war file name that i can get from pom.xml and once i change the updateportlet.xml to use correct values i am all set

Once my initial setup is in place i execute the mvn integration-test command to install the portlet for first time or update it, when i do that it take some time to build and then deploy it looks like this


Dream World said...

Nice Blog Visit My Blog:::
Online Natural Photo

Vishwa said...

Really nice article Sunil. I was looking for the portlet deployment using Maven.

Thanks again!

- Vishwanath

Dream World said...

Superb blog
Visit My Blog::
Fashion World

Carlos Gavidia said...

Very nice Blog: I'm beggining in Portal Development and I always come here for tips. Continue blogging!

Niraj Hoondlani said...

I am using ANT and xmlaccess for deployment...however when i try to update a war file it says that the war file with the uid of that portlet already exists...please assist

Vinay Teza said...

i am also facing the same issues as Niraj..plz assist

Mahua De said...

How do I run xmlaccess on remote portal server?

srjwebsolutions said...

We are leading responsive website designing and development company in Noida.
We are offering mobile friendly responsive website designing, website development, e-commerce website, seo service and sem services in Noida.

Responsive Website Designing Company in Noida
Website Designing Company in Noida
SEO Services in Noida
SMO Services in Noida

Vikas Chaudhary said...

Battery Mantra is Authorized exide car battery dealer in Noida and Greater Noida. We are providing our service in Indirapuram, Delhi, Ashok Nagar.

Exide Battery Dealer in Noida
Battery Dealer in Noida
Authorized Battery Dealer in Noida
Car Battery Dealer in Noida
Car Battery Dealer
Exide Battery Dealer

EG MEDI said... is online medical store pharmacy in laxmi nagar Delhi. You can Order prescription/OTC medicines online.
Cash on Delivery available. Free Home Delivery

Online Pharmacy in Delhi
Buy Online medicine in Delhi
Online Pharmacy in laxmi nagar
Buy Online medicine in laxmi nagar
Onine Medical Store in Delhi
Online Medical store in laxmi nagar
Online medicine store in delhi
online medicine store in laxmi nagar
Purchase Medicine Online
Online Pharmacy India
Online Medical Store