build(sdk-platform-java): Add formatter plugin to the root pom of sdk-platform-java.#12739
build(sdk-platform-java): Add formatter plugin to the root pom of sdk-platform-java.#12739
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds the fmt-maven-plugin to the root pom.xml with a skip configuration. The review feedback points out that this configuration will disable formatting across all submodules and recommends specifying a version for build reproducibility. It also suggests using false if the goal is to skip only the root POM and notes that the com.spotify.fmt plugin is no longer maintained, recommending a switch to the HubSpot alternative.
| <plugin> | ||
| <groupId>com.spotify.fmt</groupId> | ||
| <artifactId>fmt-maven-plugin</artifactId> | ||
| <configuration> | ||
| <skip>true</skip> | ||
| </configuration> | ||
| </plugin> |
There was a problem hiding this comment.
Adding the plugin with true in the root POM's section will be inherited by all submodules, effectively disabling the formatter for the entire project. Additionally, the plugin is missing a version, which is necessary for build reproducibility unless it is managed by a parent POM.
To resolve the errors at the root while allowing submodules to be formatted, you should:
- Specify a version (e.g., 2.9.1).
- Remove the true configuration. The plugin typically handles projects without Java source files (like this aggregator POM) gracefully. If you must skip it for the root only, use false.
Note: com.spotify.fmt is no longer maintained; com.hubspot.maven.plugins:fmt-maven-plugin is the recommended replacement for modern Java projects.
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.9.1</version>
</plugin>
References
- Dependency versions in example code do not need to be kept strictly up-to-date with the latest version in the pull request.
Running mvn fmt:format would result in errors in the root pom, because the formatter plugin was not migrated. Add formatter plugin to the root pom of sdk-platform-java to resolve the issue.