Maven/bnd migration and Eclipse formatter

I’ve started migrating my development environment over to maven/bnd per https://www.openhab.org/docs/developer/

One advantage of the old setup approach via Oomph was that it automatically configured the ESH profiles for Code Formatter, Code Cleanup, and Save Actions.

With the new approach, we are starting with a vanilla eclipse install, so all of this configuration must be done manually. Code Formatter and Code Cleanup settings can be imported from the filesystem (I swear there used to be a URL optional as well, but I don’t see it anymore). But Save Actions is a manual process which is quite tedious (comparing screenshots of my old Oomph env to my new workspace).

My concern is that this will create a lot of extra work for PR reviews as

  1. formatting issues will creep in and cause PR churn
  2. later PRs with proper settings will result in convoluted commits that are a mixture of code changes and raw formatting changes that were never applied in old commits.

Possible solutions:

  1. Create a bare bones Oomph profile that includes these settings by default and direct developers there.
  2. Host the formatter and cleanup configs somewhere and add a config step in the developer guide. Still a manual process though and the Cleanup settings can’t be exported :frowning:
  3. Use a git precommit hook to apply the proper formatting and cleanup? I’m not sure how feasible this is but one advantage of this approach is that it would be IDE agnostic

Thoughts?
Dave

My understanding, as is stated in the Developer Guide…

TODO : We are currently reworking how to setup a perfect development enviroment. A new step by step guide will appear here after the migration is done. Watch Issue 5005 for further information and progress.

… is that this is still a WIP. A new setup file has been created. I used it yesterday to setup another IDE, but haven’t done more with it, so don’t know if/how well it works yet.

Unfortunately that is already the case. Eclipse currently has a bug and does not apply the “ESH” formatter settings although setup via Oomph.

Already done. The formatter is linked and be downloaded from the developer guide. Oomph is preferable of course.

The problem with the Oomph setup that Kai has updated is that it downloads and tries to build the entire OH2-addons. And that not only takes ages (30 minutes for a build, 4 hours for a build with tests and checks) but also freezes Eclipse multiple times. And on top there is an automatic-rebuild loop bug in the bnd Eclipse2Maven plugin.

We need to change the workflow here. A full build is never required actually.

We can always try to use https://github.com/revelc/formatter-maven-plugin. :slight_smile: Anyhow the main point of SAT is to report issues, if we can solve them automatically for developer without Eclipse, then its even better!

I see some details on the Coding Guidelines page but both links in Section A 3 are broken:

  • This is set up automatically by the official IDE setup
  • You can manually import ESH.xml via Eclipse Preferences → Java → Code Style → Formatter

Issue 5005 is closed and the Develop Guide includes steps for bnd. I assume that means the migration is complete and everything is updated… maybe I shouldn’t assume though :slight_smile: