In order to guarantee code style consistency across the project, we're using
formatter-maven-plugin
with a custom style (based on IntelliJ's default style).
To run the formatter, execute:
mvn formatter:format
If you just want to validate that the files adhere to the formatting config, execute:
mvn formatter:validate
This command is also executed on CI, on every commit.
Go to File > Settings > Editor > Code Style > Java
and import the formatter-config.xml
as an Eclipse XML Profile.
Keep in mind this applies to other repositories you might have in the same project as well.
This repository already comes with this preconfigured, so the steps below are not necessary.
Just change the following option on your VSCode settings (for this project):
{
"java.format.settings.url": "formatter-config.xml"
}