Lukas Grygar's

Personal enterprise Java web development blog.

Liferay Theme: How to put version information from Maven's POM.xml to header meta tag

In case you developing Liferay 6.2 Theme for 3rd party it’s useful to check if correct version of theme is deployed in case you want to be sure if everything works correctly and correct version is deployed.

Directory structure of files mentioned in this tutorial is following:

├── src/main/resources
|   └──
├── src
|   └── main
|   	└── webapp
|   	    └── templates
|  	            └── portal_normal.vm
└─ pom.xml

First create file in src/main/resources and put property theme.version and assign value ${project.version} to it:


Than put version tag to POM.xml and enable filtering for directory /src/main/resources (due to fact that file resides here):


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

	<!-- rest of POM ommited -->


	<!-- rest of POM ommited -->


		<!-- rest of POM ommited -->


			<!-- rest of POM ommited -->


			<!-- rest of POM ommited -->


		<!-- rest of POM ommited -->


    <!-- rest of POM ommited -->


Finally put meta tag with name theme-version to portal_normal.vm and load content through propsUtil.get():


1 <head>
2 <!-- rest of head ommited -->
3 <meta name="theme-version" content="$propsUtil.get("theme.version")" />
4 <!-- rest of head ommited -->
5 </head>

During build Maven injects that version and after theme deployment you should be able to read theme version specified at POM.xml in generated HTML code.

Tags: liferay  liferay-portal 

Share on: Twitter  Facebook  Google+ 

Previous post: Liferay Theme localization without Hook

Next post: Liferay Portlet: How to get version information from Maven's POM.xml

Related posts: