Creating a Service Builder Project

To use Service Builder, you must generate the projects where you’ll configure your object-relational map. There’s an API project and an implementation project.

  • [project]/[project]-api/ → Service interfaces.

  • [project]/[project]-service/ → Service implementations and supporting files.

Here’s how to create a Service Builder project.

  1. Decide on a project name. If the project is part of an application, name the project after the application.

  2. Create a project using Blade CLI and the service-builder project template, passing your project name as a parameter. For example, here are Gradle and Maven commands for creating a Service Builder project called guestbook.


    blade create -t service-builder -p guestbook


    mvn archetype:generate \
    -DarchetypeGroupId=com.liferay \
    -DarchetypeArtifactId=com.liferay.project.templates.service.builder \
    -DgroupId=com.liferay \
    -DartifactId=guestbook \ \
    -Dversion=1.0 \
    -DapiPath=com.liferay.api.path \

A message like this one reports project creation success:

Successfully created project bookmarks in C:\workspaces_liferay\72-ws\modules

Blade CLI generates the parent project folder and sub-folders for the *-api and *-service module projects.

  • guestbook/
    • guestbook-api/
      • bnd.bnd
      • build.gradle
    • guestbook-service/
      • bnd.bnd
      • build.gradle
      • service.xml → Service definition file.
    • build.gradle

Congratulations! You’ve created your Service Builder project. The service.xml file is where you’ll define your model objects (entities) and services.

Service Builder Samples

Service Builder Gradle Plugin

Service Builder Maven Plugin

« Introduction to Service BuilderCreating the service.xml File »