revelc/formatter-maven-plugin

Add documentation to format pom.xml and .settings/ folder

Closed this issue · 3 comments

I am struggeling to setup a formatter to format

${project.basedir}/pom.xml
${project.basedir}/.settings/*.xml
and other files too

is there any sample to format the xml?

If you want to format pom.xml, try https://github.com/Ekryd/sortpom
For files in .settings/, those are created by Eclipse for itself, and you shouldn't be editing anything in there.

If you want to format xml in general, this plugin tries to support basic XML formatting using https://github.com/revelc/xml-formatter.

However, personally, I would just use xmllint for a lot of things.

Hi @ctubbsii

thank you for your message

I am refering mostly to your xml-formatter

Sadly there is no documentation how to format specific xml files. Are there examples to format xml files?

And I am aware of .settings is eclipse based, but sadly is that stupid that if chaging the settings the xml files get resorted and re-lineending changed based on OS. And want to get rid of this behavior to that reviews can be done easier if settings are properly done by juniors

For xmllint I did not find any resonable maven plugin. Do you know one?

Hi @ctubbsii

thank you for your message

I am refering mostly to your xml-formatter

Sadly there is no documentation how to format specific xml files. Are there examples to format xml files?

Not good documentation currently. I'd probably consider that feature experimental.

And I am aware of .settings is eclipse based, but sadly is that stupid that if chaging the settings the xml files get resorted and re-lineending changed based on OS. And want to get rid of this behavior to that reviews can be done easier if settings are properly done by juniors

You probably should just be ignoring the .settings directory in your .gitignore file, and don't check it in to your repository. Then, it doesn't matter if it's different per user.

For xmllint I did not find any resonable maven plugin. Do you know one?

You can just use exec-maven-plugin to execute xmllint directly, but I suppose that would be OS-dependent.