You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Upgrade spotless-maven-plugin to 3.x to support git worktrees #2665
mvn spotless:check and mvn spotless:apply fail in a checkout created with git worktree add:
Execution default-cli of goal com.diffplug.spotless:spotless-maven-plugin:2.44.5:check failed: Cannot find git repository in any parent directory
In a worktree .git is a file that points to the main repository, and the JGit version bundled with spotless-maven-plugin 2.44.5 cannot follow it. Because of <ratchetFrom> in the root pom.xml, Spotless needs git and so the format tier of the development harness (AGENTS.md, step 4) cannot run in a worktree at all. Worktrees are a common way to work on several issues in parallel, and the contribute skill of #2591 recommends them.
This is a known Spotless issue (diffplug/spotless#1765), fixed in spotless-maven-plugin 3.0.0 by the upgrade to JGit 7.3.
Proposal: upgrade spotless-maven-plugin in the root pom.xml from 2.44.5 to the latest 3.x (3.10.4 at the time of writing).
Things to check in the PR:
Breaking changes of 3.0.0: Java 17 is required (fine, IDEasy builds with Java 25), removeWildcardImports was renamed to forbidWildcardImports (not used in our configuration), the git pre-push hook location changed (not used, we have git-hooks/pre-commit).
spotless:check on main and on a branch with Java changes gives the same result as before, so that the upgrade does not suddenly flag or reformat existing code.
The Check formatting step of .github/workflows/build-pr.yml still passes.
A quick local check: with the version changed to 3.10.4, mvn spotless:check -pl cli -Dspotless.ratchetFrom=upstream/main succeeds in a worktree, while 2.44.5 fails with the error above.
Activity