Do not execute spotless in Java 21 #11670
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The reason to be of this PR is to be able to progress on #11656.
Spotless does not support Java 21 yet (see diffplug/spotless#1822) so this PR moves the spotless usage to its own profile, which is active automatically if and only if the JVM being used is not 21. Once Spotless support Java 21 (probably when diffplug/spotless#1822 is merged) we could just remove this profile and move the spotless config to the build->pluginManagement section.
Why don't just disable spotless with
-Dspotless.skip
?IT would be a great, but spotless doesn't work in that way. Even with that property set, spotless actually executes. What the flag controls is whether the pipeline should fail or not if spotless detects an issue in the code (like importing something that is not being used). When using Java 21, spotless throws an exception that is not caught, so it always aborts the maven execution, even if
-Dspotless.skip
is set.This changes are included in #11672, so we can decide to merge this alone or merge everything together.