TLD Formatter Gradle Plugin

The TLD Formatter Gradle plugin lets you format a project’s TLD files using the Liferay TLD Formatter tool.

The plugin has been successfully tested with Gradle 4.10.2.

Usage

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

buildscript {
    dependencies {
        classpath group: "com.liferay", name: "com.liferay.gradle.plugins.tld.formatter", version: "1.0.9"
    }

    repositories {
        maven {
            url "https://repository-cdn.liferay.com/nexus/content/groups/public"
        }
    }
}

apply plugin: "com.liferay.tld.formatter"

Since the plugin automatically resolves the Liferay TLD Formatter 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 "https://repository-cdn.liferay.com/nexus/content/groups/public"
    }
}

Tasks

The plugin adds one task to your project:

NameDepends OnTypeDescription
formatTLD-FormatTLDTaskRuns the Liferay TLD Formatter to format files.

FormatTLDTask

Tasks of type FormatTLDTask 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
argsTLD Formatter command line arguments
classpathproject.configurations.tldFormatter
main"com.liferay.tld.formatter.TLDFormatter"

Task Properties

Property NameTypeDefault ValueDescription
pluginbooleantrueWhether to format all the TLD files contained in the workingDir directory. If false, all liferay-portlet-ext.tld files are ignored. It sets the tld.plugin argument.

Additional Configuration

There are additional configurations that can help you use the TLD Formatter.

Liferay TLD Formatter Dependency

By default, the plugin creates a configuration called tldFormatter and adds a dependency to the latest released version of Liferay TLD Formatter. It is possible to override this setting and use a specific version of the tool by manually adding a dependency to the tldFormatter configuration:

dependencies {
    tldFormatter group: "com.liferay", name: "com.liferay.tld.formatter", version: "1.0.5"
}
Was this article helpful?
0 out of 0 found this helpful