Download google’s java formatter plugin:
https://github.com/google/google-java-format#eclipse
Git clone google’s java style guide:
https://github.com/google/styleguide
From a fresh install of Oxygen 2, do not launch it yet. Instead open a terminal sessions and cd to the dropins directory:
cd {oxygen-dir}/Eclipse.app/Contents/Eclipse/dropins/
Now copy the formatter plugin into the dropins subdirectory:
cp ~/Downloads/google-java-format-eclipse-plugin_1.6.0.jar .
Launch Eclipse and go into the Eclipse Preferences.
Java -> Code Style -> Formatter
you should now see a box displayed that allows you to select a formatter.
First, load the profile for ONAP by clicking the import button and browsing to the cloned directory of Google’s style guide.
The file to import is eclipse-java-google-style.xml.
Second, select the Formatter implementation “google-style-format”.
There are 2 items that ONAP is modifying (see wiki)
So Edit the active profile (which now should be GoogleStyle).
Install the Eclipse Checkstyle Plugin configuration into Eclipse.
Ensure organize imports is alphabetical
Go into XML and set to spaces and 120 width, 4 indentation
Removing White Space
Go to Preferences->java->Editor->Save Actions
Check "Perform selected actions on save"
Check "Additional Actions"
Click "Configure"
Check "Remove trailing whitespace"
Check "all Lines"
Click OK
Click "Apply and Close"