Upgrade Java to 21#3
Conversation
🦙 MegaLinter status: ✅ SUCCESS
See detailed report in MegaLinter reports |
| <groupId>com.diffplug.spotless</groupId> | ||
| <artifactId>spotless-maven-plugin</artifactId> | ||
| <version>2.43.0</version> | ||
| <configuration> | ||
| <java> | ||
| <googleJavaFormat> | ||
| <version>1.22.0</version> <!-- Java 21 compatible --> | ||
| </googleJavaFormat> | ||
| </java> | ||
| </configuration> |
There was a problem hiding this comment.
What's the reason to replace this with the spotless one?
There was a problem hiding this comment.
Up to you since you know more Java than me but I can see that the old formatter does support Java 21. All you need to do is change the group id to com.spotify.fmt and update the version then.
| <groupId>com.coveo</groupId> | ||
| <artifactId>fmt-maven-plugin</artifactId> | ||
| <version>2.8</version> | ||
| <groupId>com.diffplug.spotless</groupId> |
There was a problem hiding this comment.
I can't see this being run in the code. If I change the goal to check then it does work so I'm wondering if the apply needs to be configured to a certain phase.
| <executions> | ||
| <execution> | ||
| <goals> | ||
| <goal>format</goal> | ||
| <goal>check</goal> | ||
| </goals> | ||
| </execution> | ||
| </executions> |
There was a problem hiding this comment.
This currently ran at the end of the build and just runs a check. The previous one reformatted files as well. If you change the execution to this
<executions>
<execution>
<goals>
<goal>apply</goal>
</goals>
<phase>process-sources</phase>
</execution>
</executions>
It should work similar to what it was like before
ryangrundy7
left a comment
There was a problem hiding this comment.
If you're changing the formatter, you'll need to update the make check command in the Makefile as it was using the old formatter. Just needs to be the spotless:check command it looks like

Has the POM been updated?
Yes
The pom.xml file
project.versionmust be bumped appropriately on any code changes.done
Motivation and Context
Upgrade Java 17 to. 21
What has changed
pom.xml
Only version change
no
no test - ensure the build. is success. without any errors
How to test?
service up in running without any errors
Links
https://officefornationalstatistics.atlassian.net/browse/CN-12
Screenshots (if appropriate):