Eclipse Setup

Overview

Complete setup instructions for an Eclipse installation designed to work with this project.  Includes version info, desired plugins, formatter configuration and more.

Details

  • Download and install the latest Eclipse IDE for Java EE Developers
  • Eclipse Plugins
    • Jautodoc (find in Help → Eclipse marketplace)
    • SpotBugs (find in Help → Eclipse marketplace)
    • Checkstyle (find in Help → Eclipse marketplace)

Configuration

Download all configuration files below as developerResources.zip (NOTE the Jautodoc file may have an outdated file header, so check and fix and upload the file if that is the case)

Resource
Notes
Instructions
Checkstyle configurationCode style rules

Install plugin for Eclipse (via Marketplace).

Windows → Preferences → Checkstyle. Click "New" button, select "Internal Configuration File", name it "WCI", click the "Import" button to choose the file, and click "OK". Make the new configuration the default.

This is really for the gradle integration, see the "checkstyle" section of build.gradle for any of the projects.  No explicit action needed.

(OPTIONAL)

Checkstyle suppressionsCode style rules

This is really for the gradle integration, see the "checkstyle" section of build.gradle for any of the projects. No explicit action needed

(OPTIONAL)

JAutoDoc configuration

Configuration for JAutoDoc plugin.

Install the "JAutoDoc" plugin for Eclipse (via Marketplace).

Windows → Preferences → Java → JAutoDoc (use the "Import All" button on the bottom of the screen)

Also fix Java->CodeStyle -> Code Templates -> Comments -> "Overriding Methods" to look like this:

/* see superclass */
Line Termination, CharsetConfigure these general settings

General → Workspace.

  • Set "Text file encoding" to UTF-8
  • Set "New text file line delimiter" to Unix
Java clean up configEclipse "clean up" configuration for Java.Windows → Preferences → Java → Code style → Clean Up (Use the "import" button)
Java formatter or the RT2 FormatterEclipse formatting configuration for Java.


Windows → Preferences → Java → Code style → Formatter (Use the "import" button)

https://github.com/google/google-java-format

https://github.com/google/google-java-format/releases/download/v1.19.2/google-java-format-eclipse-plugin-1.19.2.jar → eclipse "dropins/" folder, restart and chooose a Java→Code Style->Formatter→Formatter Implementation

Javascript formatterEclipse formatting configuration for Javascript.

Windows → Preferences → Javascript → Code style → Formatter (Use the "import" button)

In Eclipse 2020-06 (and possibly above):
Windows → Preferences → Web → HTML Files → Client-side JavaScript → Code Style → Formatter (Use the "import" button)

HTML formatter


Java WarningsJava Warnings in EclipseClick on the link and follow instructions
SpotBugs excludeFilterConfiguration for SpotBugs plugin - Static code analysis configurationInstall plugin for Eclipse (via Marketplace). 
Windows → Preferences → Java → SpotBugs → Filter Files → Exclude Filter Files (use the "Add" button)
This is really for the gradle integration, see the "findbugs" section of build.gradle for any of the projects. No explicit action needed.
Javascript clean upTBD
Format On Save

Under Preferences, choose Java --> Editor --> Save Actions


Ideally all of the actions in "cleanup" would be included here in save actions as well.

Check "organize imports" and "format entire file".  For example:

Change Font SizesUnder Preferences, choose General --> Appearance --> Colors and Fonts
  • change Basic → Text Font to make the default text editor font bigger/smaller
  • Change View and Editor Folders → Tree and Table font for views for the contents of "project explorer" and "outline"
  • Change View and Editor Folders → Part title font to make the tab titles larger

Troubleshooting

  1. java.lang.NoClassDefFoundError: org/junit/runner/manipulation/Filter
    1. Sometimes this error occurs in Eclipse when trying to run a unit test.
    2. The most common cause of this is that build.gradle contains a reference to a dependency that cannot be resolved (try ./gradlew clean build from the command line)

Coding Standards to Consider (old - needs another look)

Only commit projects when the following things are the case:

  • Run "SpotBugs" on all java source folders, fix any errors encountered
  • Non-parent maven projects should not directly reference versions
    • where absolutely necessary, they should use variables for version info
  • All java errors and warnings should be removed.
  • Javadoc should be added and fleshed out
  • Imports should be properly organized and code is formatted
  • Service (JPA) calls should take parameters in general (except "add" and "update" calls).
  • List<XXX> should be used for calls without PFS parameter
  • XXXList classes should be used for calls with PFS parameter, and for REST call return values. 
  • Swagger annotations should be up to date and reflect current state of REST APIs
  • Exception handling "catch" clauses should always properly handle errors
    • Low-level code (e.g. services) should NEVER handle exceptions, they should show them
    • The right level at which to handle an error is any code that is capable of showing the user an error message.
  • System.out and System.err calls should be replaced by logger... calls
  • Remove any explicit package names, class names, file paths, database names, or other hard coded environment information that makes assumptions about what exists and where it exists.  All of this should be data-driven (either from config files or from the database).