spring-io / spring-javaformat

Apache License 2.0
797 stars 110 forks source link

Format success but checkFormat fails #347

Closed mageshbabu-spg closed 1 year ago

mageshbabu-spg commented 1 year ago

using gradle 7, Spring Boot - 2.6.6, Intellij updated to latest spring-javaformat 0.0.35 format always success but checkFormat fails

This issue only happen in my system & server looks fine

wilkinsona commented 1 year ago

Thanks for the report. Unfortunately, you haven't provided enough information to help us to diagnose the problem. I don't think your use of Spring Boot is relevant as it doesn't interact with Java Format. IntelliJ shouldn't make a difference either. I suspect the problem may be related to line endings. Can you provide the details of your system (OS, version, etc) and any version control configuration, such as .gitattributes, that would affect line endings.

wsaca commented 1 year ago

I don't know if I could use it with spring boot 3, but If org.graalvm.buildtools.native is activated then checkFormat fails because the generated files in /build/generated/aotSources/ are not formatted.

Execution failed for task ':checkFormatAot'.
> Formatting violations found in the following files:
   * build/generated/aotSources/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport__BeanDefinitions.java

When format is successfully executed I get the next output:

> Task :formatMain
Execution optimizations have been disabled for task ':formatMain' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '...\src\main\java'. Reason: Task ':compileJava' uses this output of task ':formatMain' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.6/userguide/validation_problems.html#implicit_dependency for more details about this problem.
wilkinsona commented 1 year ago

@wsaca That seems to be unrelated to the problem reported in this issue. You may want to disable the checkFormatAot task in your build configuration.

philwebb commented 1 year ago

Closing since we haven't got enough information to replicate the problem.