Digital Transformation

WebSphere Portal and Maven (Part 3)

The deployment of a portlet to a portal server is accomplished using xmlaccess (also called the XML configuration interface). At this point I need to point out that the deploy goal of maven is a separate concept from a portlet deployment. The maven deploy goal is intended to move your packaged maven artifact to the maven repository server. A portlet deployment means that you are moving and installing your portlet onto a portal server where it can be placed onto a page and receive requests.

You actually perform your portlet deployment during the pre-integeration-test phase of the maven lifecycle. This is done here instead of the deploy phase because you would not want to share the code with other developers if your integration tests fail during the integration-test phase.

The input file of an xmlaccess request is an XML configuration file with specialized syntax to describe your intended operation. You want to modify the DeployPortlet.xml sample file included in your portal installation and replace it with parameters that match the portlet you wish to deploy.

I have created an XSLT file that can process the portlet.xml descriptor and produce a valid xml configuration file that you can send in an xmlaccess request. Readers should notice that this is a modified form of the DeployPortlet.xml sample file included with the portal. In a future post I will describe how and where this file gets executed during the build.

<?xml version="1.0"?>

<xsl:output method="xml" indent="yes"/>
<xsl:param name="WAR_URL"/>
<xsl:param name="DISPLAY_NAME"/>

<xsl:template match="/">
	<xsl:comment>Generated version: 1.0</xsl:comment>
		<portal action="locate">

<xsl:template match="wps:portlet-app">
	<web-app action="update" active="true" uid="{@id}.webmod">
		<url><xsl:value-of select="$WAR_URL"/></url>
		<!-- Use the maven artifactId as the display name in the WAS console with a prefix to group together -->
		<display-name><xsl:value-of select="$DISPLAY_NAME"/></display-name>
		<servlet action="update" referenceid="{wps:portlet/wps:portlet-name}.servlet"/>
		<portlet-app action="update" uid="{@id}">
            <xsl:apply-templates select="wps:portlet"/>

<xsl:template match="wps:portlet">
	<portlet action="update" name="{wps:portlet-name}" />


Next up: WebSphere Portal and Maven (Part 4)

About the Author

More from this Author

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to the Weekly Blog Digest:

Sign Up