Migrating Traditional Plugins to Workspace Web Applications

After you’ve adapted your traditional plugin to Liferay DXP’s API, you can continue maintaining it in the Plugins SDK 7.0. The Plugins SDK, however, is no longer available for Liferay DXP 7.1. Visit the Deprecated Apps in 7.1: What To Do article for more information on the Plugins SDK removal. Liferay Workspace replaces the Plugins SDK, providing a comprehensive Gradle development environment and more. A simple command migrates traditional plugins (such as portlets) to Gradle-based web application projects. From there you can build and deploy them to Liferay DXP as Web ARchives (WARs).

Running the Migration Command

Blade CLI’s convert command migrates Plugins SDK plugins to web application projects in Workspace’s wars folder. Plugin files are re-organized to follow the standard web application folder structure.

Standard Web Application Anatomy:

  • [project root]
    • src
      • main
        • webapp
          • WEB-INF
            • classes
            • lib → Libraries
            • descriptor files
        • css → CSS files
        • js → JavaScript files
        • icons
        • JSP files
      • java → Java source
    • build files

From the command line, navigate to the Liferay Workspace root folder. Then pass your Plugins SDK project’s name to Blade’s convert command:

blade convert [PLUGIN_PROJECT_NAME]

Blade extracts the plugin from the Plugins SDK and reorganizes it in a standard web application project in Workspace’s wars folder.

Note: Executing blade convert -l lists Plugins SDK projects that can be migrated to Workspace web apps. Run blade convert --all to migrate all the plugin projects.

The image below shows the plugin files before and after they’re migrated to Workspace web apps.

Figure 1: The convert command migrates a Plugins SDK project to a Workspace web application project. It moves Java source files to src/main/java and all other files/folders to src/main/webapp.

Figure 1: The `convert` command migrates a Plugins SDK project to a Workspace web application project. It moves Java source files to `src/main/java` and all other files/folders to `src/main/webapp`.

The following table maps traditional plugin source files to the standard web application folder structure Workspace uses.

Plugins SDK folders to web application folders:

FilesPlugins SDK folder (old)Web app folder (new)
Javadocroot/WEB-INF/srcsrc/main/java
JSPsdocrootsrc/main/webapp
iconsdocrootsrc/main/webapp
CSSdocroot/csssrc/main/webapp/css
JSdocroot/jssrc/main/webapp/js
descriptorsdocroot/WEB-INFsrc/main/webapp/WEB-INF
librariesdocroot/WEB-INF/libsrc/main/webapp/lib

From your plugin’s new location, you can invoke Workspace Gradle tasks on it and build its .war file.

blade gw war

To deploy the .war, copy it from the plugin’s build/libs folder to the [LIFERAY_HOME]/deploy folder.

Welcome to your plugin’s new home in Workspace!

Workspace Development lifecycle

Workspace Gradle Tasks

« Optimizing Plugins for Liferay DXP 7.1Modularizing Plugins »
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0