Deploying a Project

Deploying a project to Liferay DXP can be completed using your tool of choice. The following tools are preconfigured (or can be easily configured) for Liferay project generation:

The deployment process is the same across all tools; the deployment command/action builds and deploys your project based on the build tool’s deployment configuration. For example, leveraging Blade CLI in a default Gradle Liferay Workspace uses the underlying Gradle deployment configuration. The build tool’s deployment configuration is found by reading the Liferay Home folder. The Liferay Home folder is preconfigured in most cases; if it’s not, ways to configure it are included below. All tools support JAR and WAR-style project deployment.

It’s recommended to deploy Liferay projects within a Liferay Workspace. Most tools, however, support deploying projects in a standalone environment (except for IntelliJ). Visit the appropriate section to learn how to deploy a project with the highlighted tool.

Blade CLI

This is the recommended way to deploy Gradle and Maven projects in a Liferay Workspace via command line. Blade CLI is leveraged by Dev Studio and IntelliJ too.

Run this command to deploy your project:

blade deploy

If you prefer not to use your underlying build tool’s (Gradle or Maven) module deployment configuration, and instead, you want to deploy straight to Liferay DXP’s OSGi container, run this command:

blade deploy -l


Deploying with pure Gradle is not recommended unless you prefer to develop outside of a Liferay Workspace. Blade CLI is a better tool for deploying Liferay Gradle projects in most cases.

  1. Apply the Liferay Gradle plugin in your project’s build.gradle file:

    apply plugin: "com.liferay.plugin"
  2. Extend the Liferay extension object to set your Liferay Home and deploy folder:

    liferay {
        liferayHome = "../../../../liferay-ce-portal-7.1.1-ga2"
        deployDir = file("${liferayHome}/deploy")
  3. Run this command to deploy your project:

    ./gradlew deploy

Liferay Dev Studio

These steps assume you’ve installed a Liferay server in Dev Studio.

  1. Right-click the server from the Servers window and select Add and Remove….

  2. Add the project(s) you’d like to deploy from the Available window to the Configured window. Then click Finish.

    Figure 1: Using the this deployment method is convenient when deploying multiple projects.

    Figure 1: Using the this deployment method is convenient when deploying multiple projects.

  3. Verify your project builds, deploys, and starts successfully by viewing the results in the Console window.

Dev Studio’s deployment mechanism executes the watch task behind the scenes. For more information on what to expect from the watch task, see this article.

Liferay IntelliJ Plugin

These steps assume you’ve installed a Liferay server in IntelliJ. A configured Liferay Workspace is required to create and deploy Liferay projects in IntelliJ.

  1. Right-click your project from within the Liferay Workspace folder structure and select LiferayDeploy.

    This automatically loads a build progress window viewable at the bottom of your IntelliJ instance.

    Figure 2: Verify that your project built successfully.

    Figure 2: Verify that your project built successfully.

  2. Verify that your project builds successfully from the build progress window. Then navigate back to your server’s window and confirm it starts in your configured Liferay DXP instance.


If you’re developing your project in a Liferay Workspace, skip to step 3.

  1. Add the following plugin configuration to your Liferay Maven project’s parent pom.xml file.


    This POM configuration applies Liferay’s Bundle Support plugin. This plugin is applied in Liferay Workspace by default. The Bundle Support configuration defines the executions tag, which configures the Bundle Support plugin to run during the pre-integration-test phase of your Maven project’s build lifecycle. The deploy goal is defined for that lifecycle phase.

  2. Define your Liferay home folder in your POM. You can do this by adding the following logic within the plugin tags, but outside of the execution tags:

  3. Run this command to deploy your project:

    mvn verify
« Creating a ProjectBlade CLI »
1 人中有 1 人觉得有帮助