spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.23k stars 40.7k forks source link

2.3.x build failed "spring-boot-autoconfigure:checkFormatMain" #33750

Closed githubyong closed 1 year ago

githubyong commented 1 year ago

springboot 2.3.x build failed( I had execute ./gradlew -p buildSrc format):

$ gradle  build -x test
> Task :spring-boot-project:spring-boot-actuator-autoconfigure:asciidoctor FAILED
> Task :spring-boot-project:spring-boot-actuator:checkFormatMain FAILED
> Task :spring-boot-project:spring-boot-autoconfigure:checkFormatMain FAILED

FAILURE: Build completed with 3 failures.

1: Task failed with an exception.
-----------
* What went wrong:
A problem was found with the configuration of task ':spring-boot-project:spring-boot-actuator-autoconfigure:asciidoctor' (type 'AsciidoctorTask').
> Directory 'C:\GIT\learn\spring-boot\spring-boot-project\spring-boot-actuator-autoconfigure\build\generated-snippets' specified for property '$3' does not exist.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':spring-boot-project:spring-boot-actuator:checkFormatMain'.
> Formatting violations found in the following files:
   * src\main\java\org\springframework\boot\actuate\amqp\package-info.java
wilkinsona commented 1 year ago

You should run the build using the wrapper to ensure that the correct version of Gradle is used. You should also verify that your line ending settings are correct. IIRC, you need to configure Windows with core.autocrlf set to true.

Also, please note that 2.3.x is no longer supported. 2.7.x and main (3.0.x) are the only supported branches at this time.

liangliplus commented 1 year ago

I have the same problem, I used branch 2.3x, and I had execute ./gradlew :spring-boot-project:spring-boot-actuator-autoconfigure:build -x , which prompted me to fail. I tried to set git config --global core.autocrlf true, but it still fails。

core.autocrlf=true

wilkinsona commented 1 year ago

You appear to have a different problem, @liangliplus. You have run the build with tests disabled. That will not work as the Actuator API documentation uses Spring REST Docs-based tests to produce some of its content.