Closed gleidson closed 1 year ago
Thanks for the sample. Unfortunately, I can't reproduce the problem you've described although I've only tried on macOS. I suspect it's due to encoding and macOS's UTF-8 default preventing the problem from occurring. I see you've set systemProp.file.encoding=utf-8
in gradle.properties
but this may not be sufficient to effect Charset.defaultCharset()
that's called in the task:
Please try configuring the encoding
explicitly:
import io.spring.javaformat.gradle.tasks.FormatterTask
// …
tasks.withType<FormatterTask> {
encoding = "UTF-8"
}
Thanks, @wilkinsona!
It worked by setting the encoding explicitly, like your suggestion!
Thanks for giving it a try. Given that you're already configuring the JavaCompile
tasks to use UTF-8
, I think it's reasonable to have to do the same for the formatter tasks as well.
We are starting a new project and will use spring boot as a base for this project. As it will be a project based on spring boot, we are considering following the spring code style and using the springformat plugin as a formatting tool.
During the evaluation process, we created a project to do some tests and found a situation where the format executes, however, when we check the formatting, it indicates that exists formatting violations.
gradlew format
gradlew check
I don't know, but is there a log of formatting violations that we could enable?
If we change the accents in the text below (Response.java), the problem stops happening.
We have another class (DemoApplication) with accents and doesn't have formatting issues:
<img width="535" alt="image" src="https://github.com/spring-io/spring-javaformat/assets/26634/69c23ecd-e698-40cf-9eb6-f5ef337b034a">
Attached the demo project
demo.zip
Other information gralle: 8.1.1 java: 17 (corretto-17 version 17.0.7) Windows 11 Intellij 2023.1.2