6
votes

How to configure or to override Liferay portal properties with portal.properties?

8

8 Answers

21
votes

Liferay properties is powerful instrument that allows us to configure Portal behaviour without coding of hooks-, ext- and theme-plugin. By new requirement we proof at first for possibility to solve this requirement with change of Liferay configuration. The default properties configuration can be found at Liferay source code: https://github.com/liferay/liferay-portal/blob/master/portal-impl/src/portal.properties or in https://github.com/liferay/liferay-portal/blob/master/portal-impl/src/portal.properties or in liferay-bundles\tomcat-7\webapps\ROOT\WEB-INF\lib\portal-impl.jar

To configure or to override configuration properties of Liferay portal we have to create portal-ext.properties at root folder of Liferay (bundled with tomcat).

Liferay
|-data
|-deploy
|-license
|-logs
|-tomcat-7.xxx
|-portal-ext.propeties        <- override portal properties
|-portal-${user}.propeties    <- override user specific properties

Usual we work in team with version control systems like git or svn, and developers have different configuration like database path etc. Liferay allows to configure user specific configuration in e.g. portal-${user}.properties. Therefor put at first to the portal-ext.properties the inclusion of user properties:

include-and-override = ${default.liferay.home}/portal-${user.name}.properties
3
votes

Remember that when you edit portal properties in the GUI (Control Panel -> Configuration -> Portal Settings), these changes take preference over whatever you have in portal-ext.properties. So if you have, let's say, a default landing page specified in Portal Settings, whatever value you put in portal-ext.properties (default.landing.page.path=/your/path) is ignored.

1
votes

Do not edit the portal.properties file. If you want to override any of the property, if not exists portel-ext.properties file in your liferay_home or ROOT/classes folder then create portel-ext.properties file in liferay_home and add your property entry in it. Restart server to see changes.

See all properties you can override portal-ext.properties

0
votes

you can override portal.properties by using hook or EXT. You can create portal-ext.properties file and put it into WEB-INF/classes folder in hook and can deploy that hook. In portal-ext.properties you can override all the properties of portal.propertis file

0
votes

You can override portal properties which are present in portal.properties file. Using creating portal-ext.properties file which can be placed in portal-home/webapp/root/web-inf/classes folder. for ex: ../liferay-portal-x-ce-ga2\tomcat-x.0\webapps\ROOT\WEB-INF\classes

in this location you can keep portal-ext.properties file which ever properties you want to override you can override.

0
votes

Yes whenever we override the liferay property by using liferay.properties file we create a file called lifery-ext.properties file and then we add over requirement inside this folder and our liferay use this file and whatever modification you performed here(liferay-ext.properties file) will reflect in your liferay setting. Thanks asif aftab

0
votes

Dont edit the portal.properties file. You can override portal.properties file making a copy and rename portal-ext.properties, which must be placed in liferay_home/portal-ext.properties

You can configure the properties in the control panel, but if you configure using both methods and there's a property conflict, the control panel settings take precedence.

0
votes

It's also important to notice that, in Liferay 7.x, if you don't set the property setup.wizard.enabled to false, a wizard setup screen will appear when you first access your portal and it will create a portal-wizard-setup.properties, wich takes precedence with portal-ext.properties.