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

Xml comments are formatted after upgrade 2.17.0 -> 2.24.1 #936

Open
martinaldrin opened this issue Sep 5, 2024 · 9 comments
Open

Xml comments are formatted after upgrade 2.17.0 -> 2.24.1 #936

martinaldrin opened this issue Sep 5, 2024 · 9 comments
Labels

Comments

@martinaldrin
Copy link

martinaldrin commented Sep 5, 2024

Describe the bug
We have started to get comments in xml formatted after we uplift the version and we can not find any configuration to disable this.

Versions (OS, Maven, Java, and others, as appropriate):
Maven 3.9.9
Java 21
Readhat 8

To Reproduce
Steps to reproduce the behavior (or a link to an example repository that reproduces the problem):
Comment out xml tags .

Expected behavior
to not remove the indentation of comment out xml tags. or a property to disable this feature

Screenshots
If applicable, add screenshots to help explain your problem.
image

In eclipse it is possible to configure if we want to format comments or not, and this configuration I miss in the maven formatter.
image

Additional context

@hazendaz
Copy link
Member

hazendaz commented Sep 9, 2024

This is the default config file. If you need different, you need to override the default.

https://github.com/revelc/formatter-maven-plugin/blob/main/src/main/resources/formatter-maven-plugin/eclipse/xml.properties

See https://code.revelc.net/formatter-maven-plugin/examples.html on how to override.

@martinaldrin
Copy link
Author

Hi, yes I’m aware of that file, but I can not find any configuration which is related to the sort of comments. Is there any descriptions of the properties?

@hazendaz
Copy link
Member

hazendaz commented Sep 9, 2024

What is your override config if any? If none, its treating tabs as spaces by default. The items while slight variations in name match up to what you see in Eclipse. In fact the code was lifted from eclipse years ago when it was added here. Code for it is here https://github.com/revelc/xml-formatter/.

See https://github.com/revelc/xml-formatter/releases, there was a bug with formatting fixed which is in 2.24.1. Have you tried others post 2.17.0 to isolate where it started?

@martinaldrin
Copy link
Author

This is our current configuration, it is based on the https://github.com/revelc/formatter-maven-plugin/blob/main/src/main/resources/formatter-maven-plugin/eclipse/xml.properties a few years ago. it has not been updated with latest. No I have not tried to pinpoint where the fault started, I can try to do that.

maxLineLength=300
splitMultiAttrs=false
tabInsteadOfSpaces=false
tabWidth=4
wellFormedValidation=WARN
wrapLongLines=false

@martinaldrin
Copy link
Author

I have now tested all version between 2.17.0 and 2.24.1, the problem started with 2.24.1, so it seems to work fine with 2.24.0

@hazendaz
Copy link
Member

hazendaz commented Sep 11, 2024 via email

@hazendaz
Copy link
Member

Not sure when I can get to this. I think you want to stick to 2.23.0 for time being as there was a bug in 2.24.0. I'm sorry we don't have release notes up here, I have been unable to get consensus as to why that is so utterly important. All we are left with is digging through this milestones which may not be entirely accurate https://github.com/revelc/formatter-maven-plugin/milestones?state=closed.

The real issue here is not the formatter here but xml-formatter project and we do have to get a number of components out to even get the eclipse 2024-06 release out and now 2024-09 is out from eclipse. So we are a bit behind here. I've been sick last few days and was hoping to address this weekend but not looking like I'll get to it. I just want to make sure you can work successfully for now until this is remediated. Thanks.

@martinaldrin
Copy link
Author

2.23.0 can not be used either, it is broken for xml formatting.
2.24.0 can not be used at all.

So I will try to use 2.22.0 for now

@hazendaz
Copy link
Member

ok thanks. Do report back what ends up working for you temporarily to help others.

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