Source Formatter Plugin

The Source Formatter plugin formats project files according to Liferay’s source formatting standards. For more documentation on Source Formatter specific functionality, visit the tool’s documentation folder.


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


You can view an example POM containing the Source Formatter configuration here.


The plugin adds one Maven goal to your project:

source-formatter:formatRuns the Liferay Source Formatter to format source formatting errors.

Available Parameters

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

Parameter NameTypeDefault ValueDescription
autoFixbooleantrueWhether to automatically fix source formatting errors.
baseDirString"./"The Source Formatter base directory. (Read-only)
fileNamesString[]nullThe file names to format, relative to the project directory. If null, all files contained in baseDir will be formatted.
formatCurrentBranchbooleanfalseWhether to format only the files contained in baseDir that are added or modified in the current Git branch.
formatLatestAuthorbooleanfalseWhether to format only the files contained in baseDir that are added or modified in the latest Git commits of the same author.
formatLocalChangesbooleanfalseWhether to format only the unstaged files contained in baseDir.
gitWorkingBranchNameString"master"The Git working branch name.
includeSubrepositoriesbooleanfalseWhether to format files that are in read-only subrepositories.
maxLineLengthint80The maximum number of characters allowed in Java files.
printErrorsbooleantrueWhether to print formatting errors on the Standard Output stream.
processorThreadCountint5The number of threads used by Source Formatter.
showDocumentationbooleanfalseWhether to show the documentation for the source formatting issues, if present.
throwExceptionbooleanfalseWhether to fail the build if formatting errors are found.
« Service Builder PluginTheme Builder Plugin »
Was this article helpful?
0 out of 0 found this helpful