Blogs
Alot of people seem to have problems deploying custom plugins to liferay. I admit that deployment can be a little tricky.
First off, Liferay has a naming convention which is more than just a naming convention and is actually designed to impose behavior. I think that in the future this should be changed to be based strictly on metadata contained in descriptors.
Anyway, that doesn't help you right now. So, plugins come in 5 types:
- hooks
- layout templates
- portlets
- themes
- webs
So, when creating plugins projects the naming of your project dir should be:
project-name-
{type-sufix}
where {type-sufix} is one of
- hook
- layouttpl
- portlet
- theme
- web
This is done automatically when using the ant tasks or create scripts in the SDK. But if you created your project from scratch but still using the liferay build scripts, then this is where you fall into the mis-naming trap.
If you don't follow this convention one potential side effect is that you end up with a deployed project with a context like:
webapps/project-name-5.1.3.7
instead of just
webapps/project-name
This is because Liferay doesn't recognize the "type" of plugin and assumes it's a plain old webapp and doesn't change the context path.
Now, sometimes your code is already written OR you are including something inside the plugin that WANTs to use a specific context path. How do you deal with that? Liferay jas a little known feature to handle this. Simply add the following in the liferay-plugin-package.properties
file.
recommended-deployment-context={desired-context-name}
This value will be used as the context path of the deployed plugin.
Enjoy!