revelc / formatter-maven-plugin

Formatter Maven Plugin
https://code.revelc.net/formatter-maven-plugin
Apache License 2.0
290 stars 91 forks source link

Includes are not honored by includeResources #832

Open nils-christian opened 8 months ago

nils-christian commented 8 months ago

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):

To Reproduce

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

ctubbsii commented 3 months ago

I don't think you have the right syntax. Try:

<includes>
  <include>**/*.java</include>
  <include>**/changelog-*.xml</include>
</includes>
nils-christian commented 2 months ago

Hi @ctubbsii,

Sorry for the late answer.

Thank you for the suggestion, but this is not working either. Also, according to the documentation, includes is of type String[].

Best regards

Nils

ctubbsii commented 2 months ago

@nils-christian Do you have an example project to demonstrate the problem, or can you make a minimal project that demos it? It would be easier to reproduce and address if that were the case, and much more likely to get addressed sooner.