revelc/formatter-maven-plugin

Add possibility to exclude sub-modules from validation and formatting

Closed this issue · 1 comments

Is your feature request related to a problem? Please describe.

In a multi-module project we have different formatting rules. More specifically, different exclusions. E.g.: One submodule contains frontend, other contains backend, etc. When mvn formatter:format is called, it is executed on all subdirectories. However, we would like to have a setting to skip the sub-module directories.

Describe the solution you'd like

Having a switch that skips sub-module directories. In case the current project type is pom and it has a modules/module section, those folders listed in modules should be skipped.

Describe alternatives you've considered

Now we have to add formatter maven plugin configuration to the aggregator projects, too.

This is a narrow application of the generalized exclusion feature that we already have. Since this can be implemented with an appropriate includes/excludes, or via POM configuration that includes the formatter.skip property in the sub-modules, I don't think there's anything to do here to support this use case.

See https://code.revelc.net/formatter-maven-plugin/format-mojo.html#skipFormatting and https://code.revelc.net/formatter-maven-plugin/format-mojo.html#excludes