I need to develop / change a binding for the openHAB 2.4 build. How can I do that? It is no option to wait for a stable 2.5 snapshot in a few weeks.
I see three options:
I get an Eclipse IDE which installs the 2.4 snaphot out of the box and I am creating the binding from scratch and create the jar and afterwards put the jar file into the addon folder
I put my binding source files into a folder and try to run the maven build outside of any openhab-eclipse environment. I guess I need to edit some pom files before having some success on this approach.
I install the current Eclipse IDE with the 2.5 snapshot and then I add my binding and run the maven build. I put the created snapshot 2.5 binding jar file into my 2.4 openhab snapshot and all runs smoothly?
IMHO 1 and 3 are the same.
When installing an IDE now you will get the snapshot version, which is actually 2.5
Coding and creating it with mvn will do the job and you can use that .jar by putting it into the add-ons folder.
BTW: If waiting a âfew weeksâ is no option, how fast do you think you can code a binding? If you are that fast, you could help out the community by working on some reported issues. WDYT?
Yes, I will try to contribute, to the addons and the core! By the way: it is not a binding to get a new home automation stack to openHAB, so the challenge wonât be that big I hope.
I tried to check the approach by setting up a fresh IDE and and then running m2eclipse with the goals âclean installâ on an existing binding as an example - here the âfeedâ-binding. The binding is not changed, it works fine in die 2.4 stable release and there is no error shown after performing all setup tasks. I was expecting, that the build will run smoothly and there will be a jar file related to the 2.5 snapshot. Instead I got this error:
[INFO] â maven-resources-plugin:3.1.0:copy-resources (default) @ org.openhab.binding.feed â
[INFO] Using âUTF-8â encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] â target-platform-configuration:1.2.0:target-platform (default-target-platform) @ org.openhab.binding.feed â
[INFO]
[INFO] â tycho-packaging-plugin:1.2.0:package-plugin (default-package-plugin) @ org.openhab.binding.feed â
[INFO] Building jar: E:\joba\workspace-openhab\OpenHabAddonDev\openhab-master\git\openhab2-addons\addons\binding\org.openhab.binding.feed\target\org.openhab.binding.feed-2.5.0-SNAPSHOT.jar
[INFO]
[INFO] â tycho-p2-plugin:1.2.0:p2-metadata-default (default-p2-metadata-default) @ org.openhab.binding.feed â
[INFO]
[INFO] â sat-plugin:0.5.0:checkstyle (default) @ org.openhab.binding.feed â
[INFO] Adding dependency to checkstyle:0.5.0
[INFO] Adding dependency to checkstyle:8.1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:25 min
[INFO] Finished at: 2019-03-12T21:01:52+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openhab.tools.sat:sat-plugin:0.5.0:checkstyle (default) on project org.openhab.binding.feed: Unable to execute mojo: An error has occurred in Checkstyle report generation. Failed during checkstyle execution: Unable to find suppressions file at location: E:\joba\workspace-openhab\OpenHabAddonDev\openhab-master\git\openhab2-addons\addons\tools\checkstyle_suppressions.xml: Could not find resource âE:\joba\workspace-openhab\OpenHabAddonDev\openhab-master\git\openhab2-addons\addons\tools\checkstyle_suppressions.xmlâ. â [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] MojoExecutionException - Apache Maven - Apache Software Foundation
Thanks for your reply. Anyway it did not solve the issue.
I was running m2eclipse with clean install and the âSkip Testsâ option. Same error - now I try to start the build on the main pom file, not on the feed package oneâs.
now I created a Run Configuration and went into the poms/tycho folder to pick the pom to run. Then I set the goals âclean installâ and the flag for âSkip Testsâ. Now the build failed, but I was able to run successfully through some bindings and so there was a jar file in the target folder!
Now I am curious if the other bundles will get built when I create a run configuration for the pom in the bnd-folder. When I exclude all other bindings besides this one I want to build, then the procedure shouldnât take that much time.
it was possible to get a successful build with your line of code. What do I need to do exactly in Eclipse m2eclipse, because there was no successful build, altough I thought that my command will do the same?
just run the following inside your binding folder and then it only builds just your binding. Also if you need to run it often, you can run with -o for offline mode and it builds so much faster as it does not download everything from scratch.
mvn clean install
Only if you are going to do a PR to merge your binding into Openhabs github do you need to run it across all bindings.
Hi Jochen, did you managed to create/edit binding? Iâm new to ECLIPSE, could you write down step by step or point to link, what needs to be installed and which options chosen and how to load an existing binding from repo, and how to create jar file?
I need to change one binding to suit my needs, unfortunatelly creator of that binding is no help, so I have to DIM
You should have started a new thread on such topic!
I used this documentation in order to setup Visual Studio Code and was able to run the binding code in debugging mode (breakpoints useable and so onâŠ) and push the changes for a PullRequest. Why donât you try the same steps?