@Oliver Bertuch introduced us to Spotless for formatting code in https://github.com/gdcc/xoai
From the README:
mvn spotless:apply
# - or to just check for consistency use -
mvn spotless:check
It works great! Should we use it with the main code base?
And the logo is awesome:
What did I do? :see_no_evil:
I have to admit, Spotless has its flaws...
You don't want it to apply on the main codebase...
Really you don't
D'oh! Why not? ![]()
Same thing as getting rid of all the tab chars and other mistakes in styling
It's gonna be an ginormous blob of changes
What if it was a brand new Java project? Use Spotless?
Not sure. Spotless is very opinionated
It might be fine just using stuff like Sonarcloud or Checkstyle
And enforce it some more
At least Checkstyle is configurable...
Spotless is more or less not
We already have a Checkstyle config: https://guides.dataverse.org/en/6.2/developers/coding-style.html#checking-your-formatting-with-checkstyle
Yeah
We do :melting_face:
The rules we have in there are never being applied...
No review is looking at this stuff
Not many people on the core team care about this... :face_with_hand_over_mouth:
Should use use Sonar instead? We do have this issue: Set up Sonar #9846
I really don't care which tool we use.
And I'll adapt to whatever opinionated style.
Sure thing. All of the gdcc things I started use Sonarcloud
Are you using Sonarcloud for code formatting in any of those projects?
But no tool will get something moving. It's a social problem, no tech is gonna solve that.
Nope, I'm just using it for annotations and recommendations
You could make it more enforcing
Matter of configuration
Well, the problem is solved in our xoai library, right?
Which problem? Formatting?
We did use spotless on it... after a huge rewrite and on a much smaller codebase with far less folks involved
The social problem. I'm seeing some back and forth at https://github.com/gdcc/xoai/pull/119 about formatting. It looks like you ran Spotless here: https://github.com/gdcc/xoai/pull/119/commits/a70ea5d0b021a9b06eb65559fee8685ca54c67e2
See what it did to the codebase? Crazy!
That a70ea commit? Looks fine.
Came across https://github.com/revelc/formatter-maven-plugin today. Sounds interesting. Enables definition of custom rules, not just adapting what others use like spotless.
Nice. Should we play around with it in a low-risk repo like https://github.com/gdcc/hello or https://github.com/gdcc/exporter-debug ?
Some new comments from @Steven Winship: https://github.com/IQSS/dataverse/pull/11016#discussion_r1850852625
@Oliver Bertuch do you have any ideas on this one? https://github.com/gdcc/exporter-croissant/issues/11
Nope, none except moving away from spotless (see above) or trying to make it exclude xml files.
Sure, but do you have any idea what maven-release-plugin is doing?
Nope. Lucky guess: it's the XML serialization. The release plugin manipulates the DOM, so maybe this is why.
yeah, maybe the flatten stuff ![]()
So you're suggesting trying https://github.com/revelc/formatter-maven-plugin instead of spotless?
@Oliver Bertuch how does this grab ya as a workaround? https://github.com/gdcc/exporter-croissant/pull/12
From https://github.com/quarkusio/quarkus/discussions/40542 I learned the Quarkus project uses https://github.com/revelc/formatter-maven-plugin to format their code. See https://github.com/quarkusio/quarkus/blob/3.29.0/CONTRIBUTING.md#formatting
Last updated: Nov 01 2025 at 14:11 UTC