From b779e8e4fcb6331827b78db6ff8ef3203660f31c Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 8 Oct 2015 22:33:08 -0700 Subject: [PATCH] Add custom Eclipse code formatter Update Eclipse settings to make use of a custom Spring formatter implementation. Using a custom formatter allows us to fix a couple of issues with the version that shipped with Eclipse Mars.1 (Eclipse bugs The custom formatter also means that it is possible to use Groovy Eclipse despite the fact that it has formatter regressions (see https://github.com/groovy/groovy-eclipse/issues/142). Fixes gh-4136 --- CONTRIBUTING.adoc | 18 ++++++++++-------- eclipse/org.eclipse.jdt.core.prefs | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc index 46e496766cb..b0b7f0e97e7 100644 --- a/CONTRIBUTING.adoc +++ b/CONTRIBUTING.adoc @@ -129,17 +129,19 @@ eclipse. If you don't already have m2eclipse installed it is available from the marketplace". Spring Boot includes project specific source formatting settings, in order to have these -work with m2eclipse, we provide an additional eclipse plugin that you can install: +work with m2eclipse, we provide additional Eclipse plugins that you can install: -* Download `org.eclipse.m2e.maveneclipse.site.zip` from - https://github.com/philwebb/m2eclipse-maveneclipse/releases. -* Select `Install new software` from the `help` menu -* Click `Add...` to add a new repository -* Click the `Archive...` button -* Select the `org.eclipse.m2e.maveneclipse.site.zip` that you previously downloaded +===== Install the m2eclipse-maveneclipse plugin +* Select "`Help`" -> "`Install New Software`". +* Add `https://dl.bintray.com/philwebb/m2eclipse-maveneclipse` as a site. * Install "Maven Integration for the maven-eclipse-plugin" -NOTE: This plugin is optional. Projects can be imported without the plugin, your code +===== Install the Spring Formatter plugin +* Select "`Help`" -> "`Install New Software`". +* Add `https://dl.bintray.com/philwebb/spring-eclipse-code-formatter/` as a site. +* Install "Spring Code Formatter" + +NOTE: These plugins are optional. Projects can be imported without the plugins, your code changes just won't be automatically formatted. With the requisite eclipse plugins installed you can select diff --git a/eclipse/org.eclipse.jdt.core.prefs b/eclipse/org.eclipse.jdt.core.prefs index 7b2f879524b..a61a84b4344 100644 --- a/eclipse/org.eclipse.jdt.core.prefs +++ b/eclipse/org.eclipse.jdt.core.prefs @@ -388,3 +388,4 @@ org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.javaFormatter=org.springframework.ide.eclipse.jdt.formatter.javaformatter