Developing Modules with Liferay Workspace

Workspace is a great Liferay module development environment because of these features:

  • Templates that bootstrap module creation
  • Gradle and Maven build systems for managing dependencies and assembling modules
  • Module deployment and runtime management capabilities

Blade CLI (Blade), which is a part of Workspace, has over thirty templates for Gradle and Maven-based module projects–and more are being added. The templates stub out classes and resource files for you to fill in with business logic and key information.

Here are some of the template’s names:

  • Activator
  • API
  • Content Targeting Report
  • Content Targeting Rule
  • Content Targeting Tracking Action
  • Control Menu Entry
  • MVC Portlet
  • Panel App
  • Portlet
  • Portlet Configuration Icon
  • Portlet Provider
  • Portlet Toolbar Contributor
  • Service
  • Service Builder
  • Service Wrapper
  • Simulation Panel Entry
  • Template Context Contributor
  • etc..

Blade creates modules based on these templates. For a full list of these templates, visit the Project Templates reference section.

For example, the following Blade command creates a Liferay MVC Portlet module called my-module:

blade create -t mvc-portlet -p com.liferay.docs.mymodule -c MyMvcPortlet my-module

Liferay Dev Studio DXP’s module project wizard creates Workspace modules from the templates too.

Figure 1: Liferay Dev Studio DXP lets developers select templates to stub out modules.

Figure 1: Liferay Dev Studio DXP lets developers select templates to stub out modules.

Liferay Dev Studio DXP’s component wizard facilitates creating component classes for portlets, service wrappers, Struts actions, and more.

Figure 2: Liferay Dev Studio DXPs component wizard facilitates creating component classes.

Figure 2: Liferay Dev Studio DXP's component wizard facilitates creating component classes.

Building and deploying modules in a Workspace is a snap using Liferay Dev Studio DXP and Blade. Workspace uses BndTools to generate each module’s OSGi headers in a META-INF/MANIFEST.MF file. Workspace deploys modules to the OSGi container using Felix File Install commands.

Liferay Dev Studio DXP lets you deploy modules by dragging them onto your Portal server.

Figure 3: Liferay Dev Studio DXP lets you deploy modules using drag-and-drop.

Figure 3: Liferay Dev Studio DXP lets you deploy modules using drag-and-drop.

To learn more about Workspace and using it in Liferay Dev Studio DXP, see this tutorial.

In a terminal, you can deploy modules using Blade’s deploy command. For example, the following command deploys the current module and “watches” for module changes to redeploy automatically.

blade deploy -w

Make sure to check out the tutorial Starting Module Development for even more information on module development.

« From the Plugins SDK to Liferay WorkspaceWhat's New for Maven Users »
この記事は役に立ちましたか?
0人中0人がこの記事が役に立ったと言っています