Creating applications is fun when you have the right tools. Here are some key ingredients:
- Rich templates for stubbing out projects
- Extensible build environments that offer state-of-the-art plugins
- Deployment and runtime management tools
- Application upgrade automation
Liferay Workspace (Workspace) boils over with all these things! It’s a Gradle-based development environment that integrates with Liferay IDE and can be used in conjunction with other IDEs, such as a “vanilla” Eclipse, IntelliJ, and NetBeans. You can extend Workspace’s Gradle environment with community-developed (or home-grown) plugins for testing, code coverage analysis, and more.
Workspace comes with Blade CLI: a command line tool for creating and deploying modules, managing the runtime environment, and more. It provides all kinds of module templates, to create modules for developing in any Gradle environment.
Liferay’s tools also streamline the application upgrade process. Liferay IDE’s Code Upgrade Tool adapts traditional plugins to Liferay Portal CE 7.0 APIs. Liferay’s Liferay Theme Generator migrates themes and layout templates to the new NodeJS-based environment and adapts them to Liferay Portal CE 7.0.
Liferay Portal offers you more with Maven too. The archetype Liferay Project Templates Workspace lets you develop in Liferay Workspace using Maven. Liferay Portal CE 7.0‘s’ lean artifacts and new project archetypes and Maven plugins make Liferay Portal development with Maven easier than ever.
Here are the tooling improvement topics:
- Moving from the Plugins SDK to Liferay Workspace
- Developing modules with Liferay Workspace
- What’s new in Liferay Portal for Maven Users
- Using other build systems and IDEs
From the Plugins SDK to Liferay Workspace
The Liferay Plugins SDK is deprecated as of Liferay Portal CE 7.0. You can continue developing on it, but should plan to eventually move to a new environment. Liferay Workspace succeeds the Plugins SDK as Liferay’s opinionated development environment. You should use it if you’re not using an alternative build system like Gradle or Maven.
Here are Workspace’s key features:
- Module and component templates
- Sample projects
- Portal server configurations
- Folder structure flexibility
- Commands to migrate plugins, install Liferay Portal bundles, and start/stop Portal instances
The plugin upgrade tutorials later in this series show how Liferay IDE automatically adapts existing plugins to Liferay Portal CE 7.0. There’s also a tutorial that demonstrates how you can optionally migrate traditional plugins to Workspace.
Here’s an example Workspace folder structure:
Here’s the Workspace anatomy:
bundles/(generated) → default folder for Liferay Portal bundles
configs/→ holds Portal server configurations
gradle/→ holds the Gradle wrapper files
modules/→ holds module projects
plugins-sdk/(generated) → holds plugins from previous releases
themes/→ holds NodeJS-based theme projects
wars/(generated) → holds traditional web application projects
build.gradle→ common Gradle build file
gradle.properties→ specifies the Portal server configuration and project locations
gradlew / gradlew.bat→ executes the Gradle command wrapper
pom.xml(only in Workspaces generated by Maven) → common Maven build file
settings.gradle→ applies plugins to the Workspace and configures its dependencies
Workspace module, theme, and war projects use the same Portal server configurations. Developers can create configurations for module development, user acceptance testing, production, and more.
Each subfolder under
configs holds a Portal server configuration defined by its
portal-ext.properties file. Gradle property
liferay.workspace.environment in Workspace’s
gradle.properties file specifies the configuration to use.
Other Gradle properties let you set root locations for the Liferay Portal bundle, modules, themes, and a Plugins SDK.
Workspace Folder Structure Properties
| ||Name of a |
| ||Liferay Portal bundle root folder|
| ||Module projects root folder|
| ||Plugins SDK root folder|
| ||Theme projects root folder|
Workspace has Gradle tasks equivalent to the Plugins SDK Ant targets.
Plugins SDK to Workspace Task Map
|Plugins SDK Ant Target||Workspace Gradle Task||Task Description|
| || ||Builds CSS files|
| || ||Translates language keys using Language Builder|
| || ||Runs Service Builder|
| || ||Deletes all build outputs|
| || ||Compiles classes|
| || ||Installs the current module to Liferay Portal’s module framework|
| || ||Compiles the project and packages it as a JAR file|
| || ||Assembles project output|
Other Workspace Gradle tasks provide additional functionality.
|Workspace Gradle Task||Task Description|
| ||Lists the project’s components|
| ||Lists the project’s declared dependencies|
| ||Downloads and installs a Liferay Portal bundle|
| ||Lists the project’s configuration model|
Next, learn how Workspace facilitates module development.
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 twenty templates for Gradle-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:
- Content Targeting Report
- Content Targeting Rule
- Content Targeting Tracking Action
- Control Menu Entry
- MVC Portlet
- Panel App
- Portlet Configuration Icon
- Portlet Provider
- Portlet Toolbar Contributor
- Service Builder
- Service Wrapper
- Simulation Panel Entry
- Template Context Contributor
Blade creates modules based on these templates.
For example, the following Blade command creates a Liferay MVC Portlet module called
blade create -t mvc-portlet -p com.liferay.docs.mymodule -c MyMvcPortlet my-module
Liferay IDE’s module project wizard creates Workspace modules from the templates too.
Liferay IDE’s component wizard facilitates creating component classes for portlets, service wrappers, Struts actions, and more.
Building and deploying modules in a Workspace is a snap using Liferay IDE and Blade. Workspace uses BndTools to generate each module’s OSGi headers in a
META-INF/MANIFEST.MF file. Workspace deploy modules to the OSGi container using Felix File Install commands.
Liferay IDE lets you deploy modules by dragging them onto your Portal server.
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
To learn more about Workspace and using it in Liferay IDE, see these tutorials:
And make sure to check out the tutorial Starting Module Development.
Next, you’ll learn new features for developing on Liferay Portal using Maven.
What’s New in Liferay Portal CE 7.0 for Maven Users
Liferay Portal CE 7.0 fully supports Maven development and offers several new and improved features:
- Liferay Workspace for Maven
- New archetypes
- New Maven plugins
- More granular dependency management
The new archetype Liferay Project Templates Workspace generates a Liferay Workspace that includes a POM file for developing in Workspace using Maven. You can develop modules and themes in the Workspace subfolders.
Liferay Portal CE 7.0 provides many new Maven archetypes for various Liferay module projects. There are over twenty-five Maven archetypes for Liferay Portal CE 7.0, and more are in development. Here are some popular ones:
- Configuration Icons
- Menu Buttons
- Service Builder
Liferay’s Maven archetypes cover many different Liferay frameworks and service types. These make Maven a first-class tool for creating Liferay modules and themes. Visit the Generating New Projects Using Archetypes tutorial to learn more about Liferay’s Maven archetypes and how to use them.
Liferay also provides several new and updated Maven plugins that simplify the build process. The following plugins build style sheets, services, and themes respectively:
Liferay Portal CE 7.0’s modularity provides a more granular dependency management experience. You no longer need to depend on
portal-kernel) for everything. For example, to use Liferay’s Wiki framework, you need only depend on the Wiki module. You set dependencies on concise modules that provide the functionality you want without inheriting extra baggage.
Liferay’s new Workspace environment, Maven archetypes, Maven plugins, and streamlined modules make developing on Liferay Portal easier than ever. To learn more, see the Maven tutorials.
Using Other Build Systems and IDEs
Liferay Portal is tool agnostic–you can use whatever tools you like to develop on it. You can use any IDE and even use Gradle, Bnd, or BndTools if you don’t want to use Workspace. The drawback is you lose the Liferay-specific project templates that you get with Blade and Workspace.
Blade lets you create modules to develop anywhere, not only in Liferay Workspace.
Here are some new Gradle features Liferay provides that are independent of Workspace:
- Liferay’s Gradle plugins
- Buildship plugins in Liferay IDE
- Liferay IDE’s new Gradle views for developing modules and working with Gradle tasks
Liferay has worked hard to make Liferay Portal IDE-agnostic. There are Liferay module developers who use IntelliJ and some enjoy using NetBeans.
Finally, you can copy and modify Liferay sample projects to serve as templates in place of the Blade templates. They’re available for these build systems:
- Liferay’s Gradle environment based on the
Liferay’s approach to tooling has vastly improved for Liferay Portal CE 7.0. Our tools help you upgrade to Liferay Portal CE 7.0, continue developing traditional plugins the way you have been, and migrate to optimal development environments. Liferay Workspace and the improved Maven support facilitate module development. And developing on Liferay Portal using other tools is easier than ever. Your tool options are wide open.