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.

Usage

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

<build>
    <plugins>
    ...
        <plugin>
            <groupId>com.liferay</groupId>
            <artifactId>com.liferay.source.formatter</artifactId>
            <version>1.0.885</version>
            <executions>
                <execution>
                    <phase>process-sources</phase>
                    <goals>
                        <goal>format</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
            </configuration>
        </plugin>
    ...
    </plugins>
</build>

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

Goals

The plugin adds one Maven goal to your project:

NameDescription
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 »
Este artigo foi útil?
Utilizadores que acharam útil: 0 de 0