Skip to content

Latest commit

 

History

History
83 lines (62 loc) · 3.2 KB

File metadata and controls

83 lines (62 loc) · 3.2 KB

Project Settings for Eclipse

This project contains the canonical set of Eclipse .settings/ files for Cloud Tools for Eclipse. These settings configure Eclipse to use the Google Style for Java.

The settings currently reflect the following choices:

  • uses the Google Java Format plugin for Eclipse, which requires developing with Eclipse Oxygen (4.7) or later
  • unnecessary declared checked exceptions on methods are errors
  • switch missing default case are warnings
  • resource leaks are errors
  • potential resource leaks are warnings
  • serializable classes without serialVersionUID are ignored
  • redundant generic type argument are errors
  • disable warnings on non-externalized strings / $NON-NLS-x$ due to google/google-java-format#221

Updating / Applying the Settings

The settings require installing the Google Java Format plugin for Eclipse. Installing the format plugin requires downloading the latest release (named google-java-format-eclipse-plugin_XXXX.jar) and placing the jar in your Eclipse installation's dropins/ directory (on MacOS, in Eclipse.app/Content/Eclipse/dropins/).

Updating and applying the settings files is a two-step process based around the eclipse-settings-maven-plugin Maven plugin.

Note: there is now a helper script in reapply.sh to perform Steps 1 and 2. It must be run from the repository root.

Step 0: Change the Canonical Settings (OPTIONAL)

To update the settings, change the settings for one project and then copy in the changed files from its .settings/ directory into files/. Note that if a new file is added, the new file must be reflected into the eclipse-settings-maven-plugin's configuration (defined in plugins/pom.xml).

Step 1: Publishing the Settings Files

This project (eclipse/settings/) publishes the settings files as a Maven jar artifact. This published jar is then used by the eclipse-settings-maven-plugin as the source for the settings files. The settings files themselves are found in in this project under files/.

To publish the settings, run the following to assemble the jar and install it in your local repository (~/.m2/repository/)

$ cd eclipse/settings
$ mvn install

Step 2: Applying the Settings

Once the settings are available, the second step invokes the eclipse-settings-maven-plugin's eclipse-settings goal to resolve the settings artifact and extract the contents to the appropriate locations. Run the following:

$ cd plugins
$ mvn --no-snapshot-updates -Dtycho.mode=maven eclipse-settings:eclipse-settings

The --no-snapshot-updates is required to resolve the settings artifact from the local repository. The -Dtycho.mode=maven speeds up the process.

Step 3: Commit

You should then commit the result.