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
-
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.
-
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
-
Navigate to File → New → Liferay Module Project.
-
Specify the project name, location, build type, Liferay DXP version, and template type.
-
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.
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’sproperty = {...}
assignment. -
Click Finish to create your project.
Liferay IntelliJ Plugin
-
Navigate to File → New → Liferay Module.
-
Select the project you want to create.
-
Configure your project’s SDK (i.e., JDK), package name, class name, and service name, if necessary. Then click Next.
-
Give your project a name. Then click Finish.
Maven
-
Execute the following Maven command:
mvn archetype:generate -Dfilter=liferay
-
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.