Service Builder Plugin

The Service Builder plugin lets you generate a service layer defined in a Service Builder service.xml file. Visit the Using Service Builder in a Maven Project tutorial to learn more about applying Service Builder to your Maven project.


To use the plugin, include it in your project’s root pom.xml file:


You can view an example POM containing the Service Builder configuration here.


The plugin adds one Maven goal to your project:

service-builder:buildRuns the Liferay Service Builder.

Available Parameters

You can set the following parameters in the <configuration> section of the POM:

Parameter NameTypeDefault ValueDescription
apiDirNameString"../portal-kernel/src"A directory where the service API Java source files are generated.
autoImportDefaultReferencesbooleantrueWhether to automatically add default references, like com.liferay.portal.ClassName, com.liferay.portal.Resource and com.liferay.portal.User, to the services.
autoNamespaceTablesbooleannullWhether to prefix table names by the namespace specified in the service.xml file.
beanLocatorUtilString"com.liferay.portal.kernel.bean.PortalBeanLocatorUtil"The fully qualified class name of a bean locator class to use in the generated service classes.
buildNumberlong1A specific value to assign the build.number property in the file.
buildNumberIncrementbooleantrueWhether to automatically increment the build.number property in the file by one at every service generation.
databaseNameMaxLengthint30The upper bound for database table and column name lengths to ensure it works on all databases.
hbmFileNameString"src/META-INF/portal-hbm.xml"A Hibernate Mapping file to generate.
implDirNameString"src"A directory where the service Java source files are generated.
inputFileNameString"service.xml"The project’s service.xml file.
modelHintsConfigsString"classpath*:META-INF/portal-model-hints.xml, META-INF/portal-model-hints.xml, classpath*:META-INF/ext-model-hints.xml, classpath*:META-INF/portlet-model-hints.xml"Paths to the model hints files for Liferay Service Builder to use in generating the service layer.
modelHintsFileNameString"src/META-INF/portal-model-hints.xml"A model hints file for the project.
osgiModulebooleannullWhether to generate the service layer for OSGi modules.
pluginNameStringnullIf specified, a plugin can enable additional generation features, such as Clp class generation, for non-OSGi modules.
propsUtilString"com.liferay.portal.util.PropsUtil"The fully qualified class name of the service properties util class to generate.
readOnlyPrefixesString"fetch, get, has, is, load, reindex, search"Prefixes of methods to consider read-only.
resourceActionsConfigsString"META-INF/resource-actions/default.xml, resource-actions/default.xml"Paths to the resource actions files for Liferay Service Builder to use in generating the service layer.
resourcesDirNameString"src"A directory where the service non-Java files are generated.
springFileNameString"src/META-INF/portal-spring.xml"A service Spring file to generate.
springNamespacesString"beans"Namespaces of Spring XML Schemas to add to the service Spring file.
sqlDirNameString"../sql"A directory where the SQL files are generated.
sqlFileNameString"portal-tables.sql"A name (relative to sqlDir) for the file in which the SQL table creation instructions are generated.
sqlIndexesFileNameString"indexes.sql"A name (relative to sqlDir) for the file in which the SQL index creation instructions are generated.
sqlSequencesFileNameString"sequences.sql"A name (relative to sqlDir) for the file in which the SQL sequence creation instructions are generated.
targetEntityNameStringnullIf specified, it’s the name of the entity for which Liferay Service Builder should generate the service.
testDirNameString"test/integration"If specified, it’s a directory where integration test Java source files are generated.
« Lang Builder PluginSource Formatter Plugin »