add @formatter:off avoid idea format xml when generate db migration
add -- @formatter:off in first line and add -- @formatter:on in last line when generate db migration
Is this really an issue? I don't understand what the issue / problem / pain point is here or why ebean generated xml should care about this?
Yes, during development using IDEA, SQL is generated and an migration is performed upon application startup. After development is complete, when committing code using Git, IDEA's reformat code feature is usually enabled. If IDEA isn't specially configured, the SQL format will change, causing errors on the next project startup.
We have/had the same issue
If IDEA isn't specially configured, the SQL format will change, causing errors on the next project startup.
Just configure your IDE correctly here:
This is stored in .idea/codeStyles/Project.xml
IJ supports flexible glob patterns, e.g. {glob1,glob2} (I often use https://globster.xyz/ for debugging)
if you have an exclusion in your .gitignore, you can define an "exclusion of exclusion" like this:
# exclude IDEA folder
.idea/*
# exclude codeStyles folder from exclusions = include
!.idea/codeStyles/
If all of you use IJ, IMHO the codeStyles folder should be part of the repo anyway, so that everyone has the same formatting rules.
(@rbygrave BTW: this may be something, we should think about in future. I often have minor problems when contributing code to ebean, as your import * rule is configured differently and my IDE reorders the imports)
If you have a project where different people use different IDEs you
- may not care much on formatting
- use some maven/gradle plugins like spotless to apply a 3rd party formatter
- use the IntelliJ CLI to apply formatting from time to time.
for the last, I've build a small (Ok, it's ~1GB) docker container (https://github.com/rPraml/intellij-formatter) that spins up IJ and apply the formatting rules (this runs in our CI pipeline)