Blogs

Blogs

Liferay Developer Mode: optimizing Liferay for development

It's been a very long time since my last post but I promise I'll make up for it with a series of posts about the latest features we've been working on for the next releases of Liferay Portal. But first, I want to blog about a topic that I think will be of a lot of interest for Portal developers: how to optimize Liferay to make development faster.

In other words how to put Liferay in what we might call a "developer mode". What would this mode do?

  • Disable all caches to reduce the need to reboot after making changes to CSS files, JavaScript files, Velocity templates in themes and Journal, etc.
  • Increase the amount of information output in case of error (very limited for now)
  • Disable features meant for production servers or evaluators

How have we achieved this? In a very simple and extensible way, by creating a new configuration file called portal-developer.properties. In order to turn on the developer mode you just have to modify the installation of Liferay you use for development to make sure the new file is loaded. The exact instructions and more details about what are its effects can be found in the wiki article Liferay Developer Mode

I've been working in this mode for several weeks now and it really makes a developer's life much easier :) But still I think this is just the beginning there are probably more optimizations we can do to this mode. So if you know of an existing property in portal.properties that should have a different value than the default during developer let me know and I'll add it. Also, if you can think of a new property that we could create to switch on or off certain behavior I'm all ears :)

Good news. Thanks a lot - I've always struggled getting the various settings right for the respective purpose and took better care of production settings than my own development settings. I'll definitely be on the look for other opportunities for these settings.

As I've only read the Wiki article, I'd like to suggest turning off the client side "session timeout" javascript that has bitten me way too often: I'm usually working in different tabs and when one tab believes that I'm timed out, it logs out all of my sessions. Auto log out might be a nice security feature in production systems, but IMHO development doesn't need that.

Olaf
Hi Olaf,

Thanks for your feedback. That's certainly a good idea although hard to implement since the timeout also involves some changes in the app server. In any case I think about it.

On a related note, what I always recommend during development is to check the "Remember me" checkbox. That way you never run into problems with session timeouts.
Why is it that the nastiest problems always have the most simple solution one can guess...?

Thanks for putting me on track... Please disregard my former suggestion. Problem solved. :-)
Thanks, Jorge! I'll begin taking advantage of this. A couple of properties that might be nice to add are:
resource.repositories.root
auto.deploy.deploy.dir

Since I do my development on a Mac and my server is a Windows 2003 box, I have to remember to change these every time I deploy a new version.
Thanks for the suggestion Josh, what values would you give to those properties for development?
By default, I would just stick with ${user.home}/liferay and ${resource.repositories.root}/deploy knowing that people will likely change them in portal-ext.properties and now portal-developer.properties.
Can I add these? They make login faster in a fresh database...

terms.of.use.required=false
users.reminder.queries.enabled=false
Hi Bruno,

I think terms.of.use.required is a good idea. I'm not so sure about reminder queries since it's a functionality that developers might want to test.