Spring-boot: Running "format" in buildSrc isn't possible when there are errors

Created on 29 Jan 2020  路  4Comments  路  Source: spring-projects/spring-boot

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

superseded

Most helpful comment

When building the main project, buildSrc is built implicitly when needed. It doesn鈥檛 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.

All 4 comments

When building the main project, buildSrc is built implicitly when needed. It doesn鈥檛 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.

Thanks for the info.

+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.

Closing in favor of PR #20806

Was this page helpful?
0 / 5 - 0 ratings