Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Includes are not honored by includeResources #832

Open
nils-christian opened this issue Feb 20, 2024 · 3 comments
Open

Includes are not honored by includeResources #832

nils-christian opened this issue Feb 20, 2024 · 3 comments
Labels

Comments

@nils-christian
Copy link

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

@ctubbsii
Copy link
Member

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

<includes>
  <include>**/*.java</include>
  <include>**/changelog-*.xml</include>
</includes>

@nils-christian
Copy link
Author

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
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants