Is there a tool to update headers in binding code when changing version?

I’m developing a new binding for Mitsubishi Heavy Industiries air conditioning and currently when jumping between the newest openhab and version 4.3.2 I need to update the headers in each java file. I can do it manually, or use linux power to fix it, but I want to be sure I’m not reinventing the wheel. Is there something in place to fix them? I develop on linux in vim (hey, the old folks with their text editors…)

Edit: update the pom file to match the version and then run:

mvn license:format

I’m asking myself if this is a “search & replace” or “git config management” problem. I assume it’s git.

I think most binding developers have the same problem due to OH main branch switched to 5.0.0. I personally don’t have a test system based on 5 version so I still test my changes on 4.

My approach
Create 2 branches

  1. mitsubishi-dev-4 based on 4.3.x
    header = 2010-2024
  2. mitsubishi-dev-main based on main
    header = 2010-2025

Do all your work, testing and commits in 1)
Do one commit into 2) after replacing header copyright
Cherry pick your commits from 1) into 2) again and again

With this approach you can switch between the above 2 branches and build either for 4 or 5 without any replacing action.

1 Like