Hi,
I just noticed that running ./gradlew format
doesn't work, when there are errors that it should correct.
E.g. in https://ci.spring.io/builds/105422 I did a small mistake and needed to correct it, but got the following when actually trying to execute format
:
* What went wrong:
Execution failed for task ':buildSrc:checkFormatMain'.
> Formatting violations found in the following files:
* src/main/java/org/springframework/boot/build/log4j2/ReproducibleLog4j2PluginsDatAction.java
Run `format` to fix.
That seems to be only the case for code located in buildSrc
. I wonder if this is something for the spring-javaformat project or if it can be worked around in Boot.
Cheers, Christoph
Comment From: wilkinsona
When building the main project, buildSrc
is built implicitly when needed. It doesn’t use the tasks specified for the main build, but those necessary to make the plugins it contains available to the main build.
You can build buildSrc
explicitly using -p
. Something like this:
./gradlew -p buildSrc format
We should make a note of this in the contributing guidelines.
Comment From: dreis2211
Thanks for the info.
Comment From: mikesmithson
+1 - I'd also like to see this in the contributing guidelines. I was having the same issue as a first time contributor and also had to make changes in buildSrc for the PR I submitted.
Comment From: philwebb
Closing in favor of PR #20806