Skip to content

Working with the Code

Chris Bono edited this page Nov 7, 2024 · 2 revisions

See the CONTRIBUTING guide for information on how to contribute issues and code changes to the project.

Using an IDE

Importing into IntelliJ IDEA

If you have performed a checkout of this repository already, use “File” → “Open” and then select the project directory to import the code.

Install the Spring Formatter plugin

The formatter plugin will allow you to format your code from within IDEA.

  • Download the latest IntelliJ IDEA plugin jar.

  • Select “IntelliJ IDEA” → “Preferences”.

  • Select “Plugins”.

  • Select the wheel and “Install Plugin from Disk…​”.

  • Select the jar file you’ve downloaded.

  • Restart IntelliJ

Configure the Spring Formatter plugin

It is a good idea to copy the default formatter to a Spring gRPC one.

  • Select “IntelliJ IDEA” → “Preferences”.

  • Select “Editor” → “Code Style”.

  • Notice the “Scheme” is set to Spring Boot Java Conventions NEW.

  • Select the wheel and “Duplicate” and name it Spring gRPC

  • Click “Ok”

Import additional code style

The formatter does not cover all rules (such as order of imports) and an additional file needs to be added.

  • Select “IntelliJ IDEA” → “Preferences”.

  • Select “Editor” → “Code Style”.

  • Select the wheel and “Import Scheme” → “IntelliJ IDEA code style XML”.

  • Select idea/codeStyleConfig.xml from this repository.

Install the Checkstyle IDEA plugin

While not strictly required, the CheckStyle-IDEA plugin hooks in the formatter rules and your local checkstyles so that any checkstyle related operations in IDEA use the rules you expect.

  • Download the latest CheckStyle-IDEA plugin.

  • Select “IntelliJ IDEA” → “Preferences”.

  • Select “Plugins”.

  • Select the wheel and “Install Plugin from Disk…​”.

  • Select the zip file you’ve downloaded.

Import additional check style
  • Download the latest spring-javaformat-checkstyle jar

  • Download the latest spring-javaformat-config jar

  • Select “IntelliJ IDEA” → “Preferences” → “Tools” → “Checkstyle”.

  • Specify the appropriate Checkstyle version (currently 9.3)

  • Add the downloaded spring-javaformat-checkstyle-0.0.43.jar and spring-javaformat-config-0.0.43.jar to the “Third-Party Checks”

  • Select “+” on “Configuration File” to add configuration file

    • Use Description: "Spring gRPC checkstyle"

    • Select "Use a local checkstyle file" and navigate to "src/checkstyle/checkstyle.xml"

    • Enter "config_loc" of "src/checkstyle" if prompted

    • Select "Next"

Important
Once all of the above is complete you can view and fix checkstyle violations directly from within IntelliJ.

Importing into Eclipse

TODO

Importing into Other IDEs

TODO

Clone this wiki locally