Creating a Project

Liferay provides many project templates you can use to generate starter projects formatted in an opinionated way. Visit the Project Templates reference section for more information on the available project templates. Each project template has different configurable options, so be sure to research a project template before generating it.

You can use your desired tool to generate a project. The following tools are preconfigured for Liferay project generation:

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

Blade CLI

  1. Print the available project templates by executing this:

    blade create -l
    

    Note the project template you want to generate; you’ll use it in the next step.

  2. Run the following command to create a Gradle project with Blade CLI:

    blade create -t [projectTemplate] [option1] [option2] ... [optionN] [projectName]
    

The available configuration options are documented for each project template. Run blade create --help for the entire list of available options.

Liferay Dev Studio

  1. Navigate to FileNewLiferay Module Project.

  2. Specify the project name, location, build type, Liferay DXP version, and template type.

    Figure 1: The New Liferay Module Project wizard offers project templates for JAR and WAR-based projects.

    Figure 1: The New Liferay Module Project wizard offers project templates for JAR and WAR-based projects.

  3. Click Next and you’re given additional configuration options based on the project template you selected. For example, if you selected a template that requires a component class, you must configure it in the wizard.

    Figure 2: Specify your component classs details in the Portlet Component Class Wizard.

    Figure 2: Specify your component class's details in the Portlet Component Class Wizard.

    You can specify your component class’s name, package name, and its properties. The properties you assign are the ones found in the @Component annotation’s property = {...} assignment.

  4. Click Finish to create your project.

Liferay IntelliJ Plugin

  1. Navigate to FileNewLiferay Module.

    Figure 3: Selecting Liferay Module opens the New Liferay Modules wizard.

    Figure 3: Selecting *Liferay Module* opens the New Liferay Modules wizard.

  2. Select the project you want to create.

    Figure 4: Choose the project template to create your module.

    Figure 4: Choose the project template to create your module.

  3. Configure your project’s SDK (i.e., JDK), package name, class name, and service name, if necessary. Then click Next.

  4. Give your project a name. Then click Finish.

Maven

  1. Execute the following Maven command:

    mvn archetype:generate -Dfilter=liferay
    
  2. Select the archetype you want to leverage and proceed through the configuration prompts.

Archetypes prefixed with com.liferay.project.templates.[TYPE] or com.liferay.faces.archetype:[TYPE] are compatible with Liferay DXP 7.2. All other Liferay archetypes are legacy archetypes targeted for previous versions of Liferay DXP.

See Maven’s Archetype Generation documentation for further details on how to modify the Maven archetype generation process.

« Introduction to ToolingDeploying a Project »
Was this article helpful?
0 out of 1 found this helpful