REST Builder Gradle Plugin

The REST Builder Gradle plugin lets you generate a REST layer defined in the REST Builder rest-config.yaml and rest-openapi.yaml files.

The plugin has been successfully tested with Gradle 4.10.2.


To use the plugin, include it in your build script:

buildscript {
    dependencies {
        classpath group: "com.liferay", name: "", version: "1.0.21"

    repositories {
        maven {
            url ""

apply plugin: ""

The REST Builder plugin automatically applies the java plugin.

Since the plugin automatically resolves the Liferay REST Builder library as a dependency, you have to configure a repository that hosts the library and its transitive dependencies. The Liferay CDN repository hosts them all:

repositories {
    maven {
        url ""


The plugin adds one task to your project:

NameDepends OnTypeDescription
buildREST-BuildRESTTaskRuns the Liferay REST Builder.


Tasks of type BuildRESTTask extend JavaExec, so all its properties and methods, such as args and maxHeapSize are available. They also have the following properties set by default:

Property NameDefault Value
argsREST Builder command line arguments

Task Properties

Property NameTypeDefault ValueDescription
copyrightFileFilenullThe file that contains the copyright header.
restConfigDirFile${project.projectDir}The directory that contains the rest-config.yaml and rest-openapi.yaml files.

In the typical scenario, the rest-config.yaml and rest-openapi.yaml files are contained in the project directory of my-rest-app-impl. In the build.gradle of the same module, apply the plugin.

The properties of type File supports any type that can be resolved by project.file. Moreover, it is possible to use Closures and Callables as values for the String properties, to defer evaluation until task execution.

Additional Configuration

There are additional configurations added to use REST Builder.

Liferay REST Builder Dependency

By default, the plugin creates a configuration called restBuilder and adds a dependency to the latest released version of Liferay REST Builder.

dependencies {
    restBuilder group: "com.liferay", name: "", version: "1.0.22"
« Node Gradle PluginService Builder Gradle Plugin »
Was this article helpful?
0 out of 0 found this helpful