This PR applies the UnusedImportsCheck Checkstyle module to the buildSrc.

See gh-31305

Comment From: snicoll

Thanks @izeye. Adding this does not seem to have any effect. How have you tested this?

Comment From: izeye

@snicoll I tested this with the following command: ./gradlew :buildSrc:checkstyleMain :buildSrc:checkstyleTest

Unfortunately, running ./gradlew :buildSrc:check produces the following failure:

> Task :buildSrc:checkFormatMain FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':buildSrc:checkFormatMain'.
> Formatting violations found in the following files:
   * src/main/java/org/springframework/build/hint/RuntimeHintsAgentArgumentProvider.java
   * src/main/java/org/springframework/build/hint/RuntimeHintsAgentExtension.java
   * src/main/java/org/springframework/build/hint/RuntimeHintsAgentPlugin.java
   * src/main/java/org/springframework/build/KotlinConventions.java
   * src/main/java/org/springframework/build/ConventionsPlugin.java
   * src/main/java/org/springframework/build/shadow/ShadowSource.java
   * src/main/java/org/springframework/build/TestConventions.java
   * src/main/java/org/springframework/build/optional/OptionalDependenciesPlugin.java
   * src/main/java/org/springframework/build/CheckstyleConventions.java
   * src/main/java/org/springframework/build/JavaConventions.java
   * src/main/java/org/springframework/build/api/ApiDiffPlugin.java
   * src/main/java/org/springframework/build/dev/LocalDevelopmentPlugin.java

  Run `format` to fix.

I stopped there as I wasn't sure if the team wants to apply it.

Comment From: snicoll

Thanks! I am trying to apply that to 6.0.x and it looks like the build is quite different there. I'll investigate a bit more

Comment From: snicoll

This PR helped discover another issue, see https://github.com/spring-projects/spring-framework/issues/31448