Liferay's Blade samples provides bootstrap project environments for all major build tools in common use for Java projects so that Liferay development can start quickly and easily.
The template projects are categorized under four build tools:
gradle
- A set of Liferay projects that can be bootstrapped onto the Gradle based development environment.liferay-gradle
- A set of Liferay projects that can be bootstrapped onto thecom.liferay.plugin
(a Gradle plugin) based development environment.maven
- A set of Liferay projects that can be bootstrapped onto the Maven development environment.bndtools
- A set of Liferay projects that can be bootstrapped onto the Bndtools based development environment.
There are 2 additional projects in the /bndtools/
folder that you will need to
build and publish the modules:
/bndtools/cnf
- The Bndtools configuration project/bndtools/blade.run
- A Bndtools project which can push bundles into an OSGi container and run them. Thebiz.aQute.remote.agent-X.X.X.jar
must be deployed first before this project will function properly.
The template projects also demonstrate how to use various frameworks:
- Blueprint
- Declarative Services (DS)
- OSGi API
Liferay does not provide a Blueprint implementation out of the box. To use the Blueprint modules provided in Blade, you must deploy a Blueprint implementation such as Apache Aries - Blueprint. Three bundles are needed:
Simply download the bundles from mvnrepository and
drop them in your osgi/modules
folder before deploying Blueprint bundles.
Extension point description:
Template project description: Uses Apache Shiro for hooking
auth.pipeline.pre
.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.authenticator.shiro |
BND Tools | ./bndtools/blade.authenticator.shiro |
Gradle | ./gradle/blade.authenticator.shiro |
Maven | ./maven/blade.authenticator.shiro |
Extension point description:
Template project description: Demonstrates a hook for auth.failure
and
auth.max.failures
.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.authfailure |
BND Tools | ./bndtools/blade.authfailure |
Gradle | ./gradle/blade.authfailure |
Maven | ./maven/blade.authfailure |
Extension point description:
Template project description: Demonstrates the AutoLogin
integration
point.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.autologin |
BND Tools | ./bndtools/blade.autologin |
Gradle | ./gradle/blade.autologin |
Maven | ./maven/blade.autologin |
Extension point description:
Template project description: Demonstrates the ConfigurationAction
integration point.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.configurationaction |
BND Tools | ./bndtools/blade.configurationaction |
Gradle | ./gradle/blade.configurationaction |
Maven | ./maven/blade.configurationaction |
Extension point description:
Template project description:
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.controlmenuentry |
BND Tools | ./bndtools/blade.controlmenuentry |
Gradle | ./gradle/blade.controlmenuentry |
Maven | ./maven/blade.controlmenuentry |
Extension point description:
Template project description:
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.corejsphook |
BND Tools | ./bndtools/blade.corejsphook |
Gradle | ./gradle/blade.corejsphook |
Maven | ./maven/blade.corejsphook |
Extension point description: Lets a developer provide (or overwrite) friendly URL mapping for portlets.
Template project description: Demonstrates how to create a
FriendlyURLMapper
for the standard NetworkUtilities
portlet.
The NetworkUtilities
portlet does not provide friendly URLs out of the box. To
test this plugin, put a NetworkUtilities
portlet on the home page. After
deploying this plugin, you can access its tabs directly using the following
URLs:
- http://localhost:8080/web/guest/home/-/NetworkUtilities/dns-lookup
- http://localhost:8080/web/guest/home/-/NetworkUtilities/whois
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.friendlyurl |
BND Tools | ./bndtools/blade.friendlyurl |
Gradle | ./gradle/blade.friendlyurl |
Maven | ./maven/blade.friendlyurl |
Extension point description:
Template project description: Demonstrates Felix Gogo commands and consuming Liferay services through DS (Declarative Services).
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.gogo |
BND Tools | ./bndtools/blade.gogo |
Gradle | ./gradle/blade.gogo |
Maven | ./maven/blade.gogo |
Extension point description:
Template project description: Demonstrates a JSP hook for login.jsp
in the
com.liferay.login.web
bundle via a fragment bundle.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.hook.jsp |
BND Tools | ./bndtools/blade.hook.jsp |
Gradle | ./gradle/blade.hook.jsp |
Maven | ./maven/blade.hook.jsp |
Extension point description:
Template project description:
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.hook.resourcebundle |
BND Tools | ./bndtools/blade.hook.resourcebundle |
Gradle | ./gradle/blade.hook.resourcebundle |
Maven | ./maven/blade.hook.resourcebundle |
Extension point description:
Template project description: Demonstrates how to create a custom
IndexerPostProcessor
.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.indexerpostprocessor |
BND Tools | ./bndtools/blade.indexerpostprocessor |
Gradle | ./gradle/blade.indexerpostprocessor |
Maven | ./maven/blade.indexerpostprocessor |
Extension point description: Demonstrates how to implement a Liferay
com.liferay.portal.kernel.events.LifecycleAction
. This API replaces all the
legacy lifecycle events such as com.liferay.portal.kernel.events.Action
,
com.liferay.portal.kernel.events.SessionAction
, and
com.liferay.portal.kernel.events.SimpleAction
. Connecting a LifecycleAction
to a particular event is determined by the OSGi service property key
. The
following keys are supported:
application.shutdown.events
- fired during destruction of company instances at portal shutdown.application.startup.events
- fired during initialization of company instances at portal start, or when a new instance is created.global.shutdown.events
- fired during destruction of the portal's main servlet.global.startup.events
- fire during initialization of the portal's main servlet.layout.configuration.action.delete
- fired during destruction of a page (Layout).layout.configuration.action.update
- fired during initialization of a page (Layout).login.events.post
- fired immediately following login.login.events.pre
- fired immediately prior to login.logout.events.post
- fired immediately following logout.logout.events.pre
- fired immediately prior to logout.servlet.service.events.post
- fired following requests to the portal (including all portlet container requests).servlet.service.events.pre
- fired prior to requests to the portal (including all portlet container requests & post login).servlet.session.create.events
- fired during creation of a portal's HTTP session.servlet.session.destroy.events
- fired during destruction of a portal's HTTP session.
Template project description: Demonstrates a hook for login.events.pre
.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.lifecycle.loginpreaction |
BND Tools | ./bndtools/blade.lifecycle.loginpreaction |
Gradle | ./gradle/blade.lifecycle.loginpreaction |
Maven | ./maven/blade.lifecycle.loginpreaction |
Extension point description: Model Listeners are used to listen for events on models and do something in response.
Template project description: Demonstrates how to create a model listener
for Layout
.
After deploying this plugin, the title of any newly created page will be automatically set to Title generated by model listener!.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.modellistener |
BND Tools | ./bndtools/blade.modellistener |
Gradle | ./gradle/blade.modellistener |
Maven | ./maven/blade.modellistener |
Extension point description:
Template project description: Demonstrates how to make a hook for a
PollerProcessor
.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.pollprocessor |
BND Tools | ./bndtools/blade.pollprocessor |
Gradle | ./gradle/blade.pollprocessor |
Maven | ./maven/blade.pollprocessor |
Extension point description:
Template project description: Demonstrates the MVCActionCommand
extension
point. It integrates the action command named greet
with portlet greeter
. To
see how this example works, a portlet plugin with a portlet named greeter
(javax.portlet.name='greeter'
) should be deployed. The command adds a key
greeting_message
to Liferay SessionMessages
, along with a session attribute
GREETER_MESSAGE
. You can independently deploy the bundle
blade.portlet.actioncommand
(i.e., refresh the bundle without the need to
redeploy the Portlet plugin).
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.portlet.actioncommand |
BND Tools | ./bndtools/blade.portlet.actioncommand |
Gradle | ./gradle/blade.portlet.actioncommand |
Maven | ./maven/blade.portlet.actioncommand |
Below are examples of building portlets using different frameworks:
Template project description: Demonstrates how to use the Blueprint framework for registering a portlet.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.portlet.blueprint |
BND Tools | ./bndtools/blade.portlet.blueprint |
Gradle | ./gradle/blade.portlet.blueprint |
Maven | ./maven/blade.portlet.blueprint |
Template project description: Demonstrates how to use the DS (Declarative Services) framework for registering a portlet.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.portlet.ds |
BND Tools | ./bndtools/blade.portlet.ds |
Gradle | ./gradle/blade.portlet.ds |
Maven | ./maven/blade.portlet.ds |
Extension point description:
Template project description: Demonstrates a simple JSP portlet.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.portlet.jsp |
BND Tools | ./bndtools/blade.portlet.jsp |
Gradle | ./gradle/blade.portlet.jsp |
Maven | ./maven/blade.portlet.jsp |
Template project description: Demonstrates how to use the raw OSGI APIs for registering a portlet.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.portlet.osgiapi |
BND Tools | ./bndtools/blade.portlet.osgiapi |
Gradle | ./gradle/blade.portlet.osgiapi |
Maven | ./maven/blade.portlet.osgiapi |
Extension point description:
Template project description:
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.portlet.configuration.icon |
BND Tools | ./bndtools/blade.portlet.configuration.icon |
Gradle | ./gradle/blade.portlet.configuration.icon |
Maven | ./maven/blade.portlet.configuration.icon |
Extension point description:
Template project description:
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.portlet.controlpanel |
BND Tools | ./bndtools/blade.portlet.controlpanel |
Gradle | ./gradle/blade.portlet.controlpanel |
Maven | ./maven/blade.portlet.controlpanel |
Extension point description:
Template project description: Demonstrates how to apply PortletFilter
s.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.portlet.filter |
BND Tools | ./bndtools/blade.portlet.filter |
Gradle | ./gradle/blade.portlet.filter |
Maven | ./maven/blade.portlet.filter |
Extension point description:
Template project description:
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.portlet.toolbar.contributor |
BND Tools | ./bndtools/blade.portlet.toolbar.contributor |
Gradle | ./gradle/blade.portlet.toolbar.contributor |
Maven | ./maven/blade.portlet.toolbar.contributor |
Extension point description:
Template project description:
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.resourcebundle |
BND Tools | ./bndtools/blade.resourcebundle |
Gradle | ./gradle/blade.resourcebundle |
Maven | ./maven/blade.resourcebundle |
Extension point description: Lets developers create custom JAX-RS standard based RESTful services.
Template project description: Demonstrates how to create a JAX-RS service that lists Liferay users.
NOTE: Before this service is accessible, the developer needs to configure endpoints for it. To do so, go to the Control Panel → System → System Settings → Foundation and then
- Search for CXF Endpoints
- Create a new CXFEndpoint publisher configuration providing a context path
(e.g.,
/rest-test
). - Go back to System Settings → Foundation and select REST Extender.
- Create a new REST extender configuration (i.e., search with
rest
) providing context paths (e.g.,/rest-test
) andjaxrs.applications.filters
set to(jaxrs.application=true)
.
Then you can access the service via http://localhost:8080/o/rest-test/blade.users/list/.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.rest |
BND Tools | ./bndtools/blade.rest |
Gradle | ./gradle/blade.rest |
Maven | ./maven/blade.rest |
Extension point description:
Template project description:
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.schedulerentry |
BND Tools | ./bndtools/blade.schedulerentry |
Gradle | ./gradle/blade.schedulerentry |
Maven | ./maven/blade.schedulerentry |
Extension point description:
Template project description: Demonstrates how to wrap the
UserLocalService
with custom a UserLocalServiceWrapper
.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.service.hook.user |
BND Tools | ./bndtools/blade.service.hook.user |
Gradle | ./gradle/blade.service.hook.user |
Maven | ./maven/blade.service.hook.user |
Extension point description:
Template project description: Demonstrates how to create a Service Builder project separated into four bundles:
api
bundle is for interfacessvc
bundle is for implementationstest
bundle is for testingweb
bundle is a portlet calling the generated services
Template projects links:
Build tool | subproject | Link to project's source code |
---|---|---|
Liferay Gradle | API | ./liferay-gradle/blade.servicebuilder.api |
Liferay Gradle | Service | ./liferay-gradle/blade.servicebuilder.svc |
Liferay Gradle | Test | ./liferay-gradle/blade.servicebuilder.test |
Liferay Gradle | Web | ./liferay-gradle/blade.servicebuilder.web |
BND Tools | API | ./bndtools/blade.servicebuilder.api |
BND Tools | Service | ./bndtools/blade.servicebuilder.svc |
BND Tools | Test | ./bndtools/blade.servicebuilder.test |
BND Tools | Web | ./bndtools/blade.servicebuilder.web |
Gradle | API | ./gradle/blade.servicebuilder.api |
Gradle | Service | ./gradle/blade.servicebuilder.svc |
Gradle | Test | ./gradle/blade.servicebuilder.test |
Gradle | Web | ./gradle/blade.servicebuilder.web |
Maven | All (parent) | ./maven/blade.servicebuilder |
Extension point description:
Template project description:
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.simulation.panel.app |
BND Tools | ./bndtools/blade.simulation.panel.app |
Gradle | ./gradle/blade.simulation.panel.app |
Maven | ./maven/blade.simulation.panel.app |
Extension point description:
Template project description: Demonstrates how to write a StrutsAction
.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.strutsaction |
BND Tools | ./bndtools/blade.strutsaction |
Gradle | ./gradle/blade.strutsaction |
Maven | ./maven/blade.strutsaction |
Extension point description:
Template project description: Demonstrates how to write a
StrutsPortletAction
.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.strutsportletaction |
BND Tools | ./bndtools/blade.strutsportletaction |
Gradle | ./gradle/blade.strutsportletaction |
Maven | ./maven/blade.strutsportletaction |
Extension point description:
Template project description:
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay Gradle | ./liferay-gradle/blade.template.context.contributor |
BND Tools | ./bndtools/blade.template.context.contributor |
Gradle | ./gradle/blade.template.context.contributor |
Maven | ./maven/blade.template.context.contributor |
This project does not yet have template projects for the following extension points. We encourage you to contribute some!
- com.liferay.mail.util.Hook
- com.liferay.portal.kernel.atom.AtomCollectionAdapter
- com.liferay.portal.kernel.format.PhoneNumberFormat
- com.liferay.portal.kernel.lar.PortletDataHandler
- com.liferay.portal.kernel.lar.StagedModelDataHandler
- com.liferay.portal.kernel.lock.LockListener
- com.liferay.portal.kernel.notifications.UserNotificationHandler
- com.liferay.portal.kernel.pop.MessageListener
- com.liferay.portal.kernel.portlet.FriendlyURLMapper
- com.liferay.portal.kernel.portlet.PortletLayoutListener
- com.liferay.portal.kernel.sanitizer.Sanitizer
- com.liferay.portal.kernel.scheduler.SchedulerEntry
- com.liferay.portal.kernel.scheduler.SchedulerEntry
- com.liferay.portal.kernel.search.Indexer
- com.liferay.portal.kernel.search.OpenSearch
- com.liferay.portal.kernel.servlet.URLEncoder
- com.liferay.portal.kernel.template.TemplateHandler
- com.liferay.portal.kernel.template.TemplateManager
- com.liferay.portal.kernel.trash.TrashHandler
- com.liferay.portal.kernel.upgrade.UpgradeProcess (call the Release service)
- com.liferay.portal.kernel.webdav.WebDAVStorage
- com.liferay.portal.kernel.workflow.WorkflowHandler
- com.liferay.portal.kernel.xmlrpc.Method
- com.liferay.portal.model.ModelListener
- com.liferay.portal.security.auth.AuthToken
- com.liferay.portal.security.auth.AuthVerifierConfiguration
- com.liferay.portal.security.auth.AutoLogin
- com.liferay.portal.security.auth.EmailAddressGenerator
- com.liferay.portal.security.auth.EmailAddressValidator
- com.liferay.portal.security.auth.FullNameGenerator
- com.liferay.portal.security.auth.FullNameValidator
- com.liferay.portal.security.auth.ScreenNameGenerator
- com.liferay.portal.security.auth.ScreenNameValidator
- com.liferay.portal.security.ldap.AttributesTransformer
- com.liferay.portal.security.membershippolicy.OrganizationMembershipPolicy
- com.liferay.portal.security.membershippolicy.RoleMembershipPolicy
- com.liferay.portal.security.membershippolicy.SiteMembershipPolicy
- com.liferay.portal.security.membershippolicy.UserGroupMembershipPolicy
- com.liferay.portal.security.permission.BaseModelPermissionChecker
- com.liferay.portal.security.permission.PermissionPropagator
- com.liferay.portal.security.pwd.Toolkit
- com.liferay.portal.verify.VerifyProcess
- com.liferay.portlet.asset.model.AssetRendererFactory
- com.liferay.portlet.ControlPanelEntry
- com.liferay.portlet.ControlPanelEntry
- com.liferay.portlet.DefaultControlPanelEntryFactory
- com.liferay.portlet.dynamicdatamapping.render.DDMFormFieldRenderer
- com.liferay.portlet.dynamicdatamapping.util.DDMDisplay
- com.liferay.portlet.expando.model.CustomAttributesDisplay
- com.liferay.portlet.social.model.SocialActivityInterpreter
- com.liferay.portlet.social.model.SocialRequestInterpreter
- java.util.ResourceBundle
- javax.portlet.filter.ActionFilter
- javax.portlet.filter.EventFilter
- javax.portlet.filter.RenderFilter
- javax.portlet.filter.ResourceFilter
- javax.portlet.PreferencesValidator
- javax.servlet.Filter (Liferay InvokerFilterChain Filters)
These templates can be copied freely and contributions are welcome. You can
contribute additional template samples by creating the project for one of the
four build tools and sending a pull request to liferay/liferay-blade-samples
.
A repository admin will review the submission and replicate the project for the
other three build tools, once the submission is approved.