revelc/formatter-maven-plugin

Includes are not honored by includeResources

Opened this issue · 0 comments

Hi,

Describe the bug

According to the documentation of "includeResources", the "included/excluded patterns for this plugin are honored". This does not seem to be the case.

Versions (OS, Maven, Java, and others, as appropriate):

  • Affected version(s) of this project: 2.23.0
  • OS: Windows 10 Pro
  • Others: -

To Reproduce

  • Create a project with two files within the resource folder: log4j2.xml and changelog-001.xml.
  • Use following plugin configuration:
<plugin>
	<groupId>net.revelc.code.formatter</groupId>
	<artifactId>formatter-maven-plugin</artifactId>
	<version>2.23.0</version>
	<configuration>
		<includes>**/*.java, **/changelog-*.xml</includes>
		<skipCssFormatting>true</skipCssFormatting>
		<skipHtmlFormatting>true</skipHtmlFormatting>
		<skipJsFormatting>true</skipJsFormatting>
		<includeResources>true</includeResources>
	</configuration>
	<executions>
		<execution>
			<id>formatter-format</id>
			<goals>
				<goal>format</goal>
			</goals>
			<phase>none</phase>
		</execution>
	</executions>
</plugin>
  • Trigger the plugin by executing "mvn -q net.revelc.code.formatter:formatter-maven-plugin:format@formatter-format"

Expected behavior

Only Java files and the changelog-001.xml file should be modified. Instead the log4j2.xml file is modified as well. According to the documentation, one would expect that the includes-pattern is applied to all files and not only to those in the source folders.

Additional context

What we want to achieve: We want to include certain files within source and resource folders to be formatted, but we want to whitelist those files. It is not feasible to define an exclude pattern for all files that should not be formatted.

Thank you and best regards

Nils