The IDE we have used is Intellij.
We recommend that you install the following plugins:
- Lombok - To reduce the amount of boiler-plate code that needs to be written
- SonarLint - Fix and detect code quality issues (https://www.sonarlint.org/)
- Spring Assistant - An IntelliJ plugin for aiding Spring development projects (https://plugins.jetbrains.com/plugin/10229-spring-assistant)
- Spring Tools - Adds Spring support for IDEs (https://spring.io/tools)
- CheckStyle - Flags up issues with coding style (https://checkstyle.sourceforge.io/)
- google-java-format Formatter - Formats code according to configuration (https://github.com/amido/stacks-java/blob/master/tools/formatter/intellij-java-google-style.xml)
Plugins used in POM
- Lombok - Avoids need to write e.g. Getter, Setter, RequiredArgsConstructor, ToString, EqualsAndHashCode) in Java classes.
- JaCoCo - A free Java code test coverage library.
- Surefire - Used for reporting purposes (creates reports based on tests in the Java test package).
- fmt-maven-plugin - Formats the java code based on rules in java-google-style.xml.
- Spotbugs - Performs a static analysis of the Java code to check for bugs.
Set up the project
How to import the whole project
In the IDE(We used Intellij) go to File -> New -> Project. Set project SDK to Java 11. Click Next -> Next
Choose the java project folder click finish.
What setup required to get it up and running
Open up the "java" folder and right click on pom.xml and choose "Add as Maven Project". Click on Run -> Edit Configurations Click on Add new Configuration and choose Application/Spring boot Choose the main class as "Application.java" and under environment set environment variable for AZURE_COSMOSDB_KEY and set JRE to Java 11. Click OK
Open Application.java file and right click and choose run Application.
intellij-java-google-style.xml formatter configuration file into the IDE from here.
The Java source code will automatically be reformatted to comply with the Google Java Style.
You can override the settings locally in the codebase by adding, for example:
Validating and applying formatting
<PROJECT-NAME>/java folder run
To validate the current formatting. You can then run the below code to apply formatting to the source code.
Verifying common programming flaws