We use Spotless to format Java code:
mvn spotless:apply
Refer to Flink's Guild to Set Up IDE.
Install necessary plugins:
Set up Checkstyle plugin
- Go to “Settings” → “Tools” → “Checkstyle”.
- Set “Scan Scope” to “Only Java sources (including tests)”.
- For “Checkstyle Version” select “8.14”.
- Under “Configuration File” click the “+” icon to add a new configuration.
- Set “Description” to “RisingWave”.
- Select “Use a local Checkstyle file” and point it to tools/maven/checkstyle.xml located within your cloned repository.
- Select “Store relative to project location” and click “Next”.
- Configure the property checkstyle.suppressions.file with the value suppressions.xml and click “Next”.
- Click “Finish”. 10 Select “RisingWave” as the only active configuration file and click “Apply”.
Set up google-java-format plugin
- Go to “Settings” → “Other Settings” → “google-java-format Settings”.
- Tick the checkbox to enable the plugin.
- Change the code style to “Android Open Source Project (AOSP) style”.
Import checkstyle configuration to java code formatter
- Go to “Settings” → “Editor” → “Code Style” → “Java”.
- Click the gear icon next to “Scheme” and select “Import Scheme” → “Checkstyle Configuration”.
- Navigate to and select tools/maven/checkstyle.xml located within your cloned repository.
Install extension Checkstyle for Java
Config with the following. It may work.
{
"java.checkstyle.configuration": "${workspaceFolder}/tools/maven/checkstyle.xml",
"java.checkstyle.version": "8.14",
"java.checkstyle.properties": {
"checkstyle.suppressions.file": "${workspaceFolder}/tools/maven/suppressions.xml"
},
"java.format.settings.url": "https://raw.githubusercontent.com/aosp-mirror/platform_development/master/ide/eclipse/android-formatting.xml",
"java.format.settings.profile": "Android"
}
mvn clean deploy --pl udf --am