This project is set up with the Spotless formatter and Maven Toolchains. Below are quick instructions to format code and configure Java toolchains.
Common commands:
- Check formatting (fails build on violations): mvn spotless:check
- Apply formatting fixes: mvn spotless:apply
Notes:
- Spotless is also bound to the
verifyphase to runspotless:checkautomatically. - The current configuration formats Java sources under
src/main/javausing Palantir Java Format (seepom.xml).
This project uses the Maven Toolchains Plugin so you can build with specific JDKs without changing your system default.
- Create or edit your Maven toolchains file at:
- macOS/Linux: ~/.m2/toolchains.xml
- Windows: %USERPROFILE%.m2\toolchains.xml
- Paste your toolchain definitions. Example:
<?xml version="1.0" encoding="UTF-8"?>
<toolchains>
<!-- JDK toolchains -->
<toolchain>
<type>jdk</type>
<provides>
<version>1.8</version>
<vendor>liberica</vendor>
</provides>
<configuration>
<jdkHome>/Users/your-username/.local/share/mise/installs/java/liberica-8u462+11</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>21</version>
<vendor>liberica</vendor>
</provides>
<configuration>
<jdkHome>/Users/your-username/.local/share/mise/installs/java/liberica-21.0.8+12</jdkHome>
</configuration>
</toolchain>
</toolchains>- How it ties into this project:
pom.xmlconfigures the Maven Toolchains Plugin to select a Liberica JDK 1.8 for compilation.- The Maven Compiler Plugin uses
release 8to compile against Java 8 APIs.
- Verify toolchain selection
- Show toolchain resolution details:
mvn -X -ntp -V validate
(Look for "Required toolchain: jdk [ vendor='liberica' version='1.8' ]" and the resolved
jdkHome.) - Print active Java during build (optional): mvn -q --version
- Format code: mvn spotless:apply
- Check formatting in CI: mvn -B -ntp verify
- Full build from scratch: mvn -B -ntp clean verify
- If Maven cannot find the requested toolchain, ensure the
vendorandversionintoolchains.xmlmatch those inpom.xml(this project expects vendorlibericaand version1.8). - Confirm the
jdkHomepaths exist and point to valid JDK installations (not a JRE). - You can install additional JDKs and add them to
toolchains.xmlas shown above.