spring-projects / spring-projects/spring-security

Format check fails on fresh repo checkout

Open
#14,575 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: feedback-provided type: bug
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

Describe the bug
After checking out the repository I want to run the ./gradlew format check to make sure everything is ok before starting a new PR like described in the contribution documentation, but it fails with

$ ./gradlew format check
> Task :spring-security-aspects:checkFormatTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Some problems were found with the configuration of task ':spring-security-aspects:checkFormatTest' (type 'CheckFormat').
  - Gradle detected a problem with the following location: '/Users/.../spring-security/aspects/src/test/java'.

    Reason: Task ':spring-security-aspects:checkFormatTest' uses this output of task ':spring-security-aspects:formatTest' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.

    Possible solutions:
      1. Declare task ':spring-security-aspects:formatTest' as an input of ':spring-security-aspects:checkFormatTest'.
      2. Declare an explicit dependency on ':spring-security-aspects:formatTest' from ':spring-security-aspects:checkFormatTest' using Task#dependsOn.
      3. Declare an explicit dependency on ':spring-security-aspects:formatTest' from ':spring-security-aspects:checkFormatTest' using Task#mustRunAfter.

    For more information, please refer to https://docs.gradle.org/8.6/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
  - Gradle detected a problem with the following location: '/Users/.../spring-security/aspects/src/test/aspectj'.

    Reason: Task ':spring-security-aspects:checkFormatTest' uses this output of task ':spring-security-aspects:formatTest' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.

    Possible solutions:
      1. Declare task ':spring-security-aspects:formatTest' as an input of ':spring-security-aspects:checkFormatTest'.
      2. Declare an explicit dependency on ':spring-security-aspects:formatTest' from ':spring-security-aspects:checkFormatTest' using Task#dependsOn.
      3. Declare an explicit dependency on ':spring-security-aspects:formatTest' from ':spring-security-aspects:checkFormatTest' using Task#mustRunAfter.

    For more information, please refer to https://docs.gradle.org/8.6/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.

Running it with a ./gradlew clean build works without issues, but also invoking the ./gradlew format check after this fails with the same issue

To Reproduce
do a new git clone of the spring security main branch and run the ./gradlew format check in the folder

Expected behavior
I would expect the gradle task to finish without issues like described in the contribution documentation

Sample

Sample is in this case the main branch of the repository

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the contribution documentation and reproduce the failure on a fresh clone using ./gradlew format check. Investigate the spring-security-aspects tasks formatTest and checkFormatTest, especially their use of src/test/java and src/test/aspectj. Done means the documented command completes successfully on a fresh checkout and still works after ./gradlew clean build.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.