Getting started with OH Dev

I’m new to OH2 development and just started to develop a binding for the Rachio sprinkler controllers. So I did a clean install of the JDK (latest 1-8), Maven (latest 3.x), Eclipse IDE (Oxygen) as advised. After startup project structure is created, I closed some projects to get rid of the errors and started creating org.openhab.binding.rachio. So far so good.

One problem to overcome: building org.openhab.core.karaf fails. When opening pom.xml I see:

Plugin execution not covered by lifecycle configuration: org.commonjava.maven.plugins:directory-maven-plugin:0.2:highest-basedir (execution: directories, phase: initialize)

so I needs to

First problem: I followed @Kai video tour on youtube. After installing everything on OSX (latest macOS) and trying to open the page load forever. A tried a fresh install and a second OSX machine - same problem. I found a post from 2016 that it was a problem with TTS+audio initialization, but don’t know what can be done rather than installing the latest macOS updates. Audio ist working fine on both systems. Finally I moved to a Windows VM :frowning: . A fresh install worked like expected including launching the local PaperUI. Do first question: How to fix this problem on macOS? Ist it known? In total I tried 5 fresh installs without a working result.

Now I got stuck, because I’m not able to add a dependency using pom.xml->Maven->Add Plug-In dependency. When start tying org.eclipsehome or org.openhab or even org.apache nothing will be shows as search result. I found on Google the hint to rebuild the repository index, did it, no result. :frowning: I tried reinstalling the Maven integration (oping to fix some settings problems etc.) - no success. I’m able to add code and it builds and runs, but I can’t add any other dependency (incl. ESH components).

I love openHAB :frowning: and like to contribute, but I’m just stuck on the dev environment. :frowning:
Any help is appriciated :wink:

I’m also looking for a good tutorial on OH2 binding development, esp. how to implement a bridge and discovery service.

In between I did another fresh install on Windows. Again when trying to add a plugin dependency I see

Index downloads are disabled, search results may be incomplete

and empty search results when trying to add a Maven dependency.

I enabled “Download repository index updates on startup” in the Maven settings, restarted Eclipse, it shows updating indexes, but same result. Maybe I’m on the wrong way.

So: How to add

import org.apache.commons.lang.StringUtils
import org.eclipse.smarthome.config.core.status.ConfigStatusMessage

to my binding project?

I tried to set up the develop environment some times ago and did not succeed. The much i enjoyed developing with eclipse, the much i hated setting up the environment (always needed help).

It would be great if an experienced OH dev could set up a VM with the development environment, if possible. :wink:


@sihui or @rlkoshak: any idea?

No, sorry, never did any development, just a plain user :innocent:

Did you try to “fix project setup”?

When you go to the file with the import statement, it should show an error and you can find the above mentioned thing in the quick fixes (ctrl + 1)


I get the following window afterwards


and it should possibly work then at least for this error.

There is maybe another pointer to this fixing method somewhere else.
I found it just there, while i had the same problem with gson and use it this way since that day.

1 Like

great, that worked!!
you saved my weekend :sunny:

Still interested in the setup problem on macOS. Does anyone experienced the same problem (browser loads forever when opening local PaperUI), of of course some guidance how to implement the bridge + discover functions is very welcome.

Have a nice weekend - it’s raining here, but now I could spend some time on the binding :wink:

1 Like

anyways, thanks for the fast response :+1:

1 Like

I think the development documentation could be improved in different aspects,
at least for people who don’t work everyday with build tools und dev stuff. (like me :smiley:)

The videos helped a lot, but when it come to error messages, i have to search along every time.

Another thing is the esh documentation.
I have found out “by accident” that i can set a password context for config inputs.
I have searched for it in the esh docs, but found it while browsing through some files in a PR on the smarthome repo (weeks later).

I have a list and have written down some things that a team-development rookie like me would like to improve.
maybe you can do somethign similar and we can help in the future by at least filing some issues and writing the problems we had down. :slight_smile:

1 Like

As I said:

  • A tutorial for binding development including a complete code sample
  • step-by-step skeleton->adding channels->adding bridge->adding discovery
  • also explaining the xml stuff
    and a Eclipse setup which works on macOS right after a fresh install.

Checking other bindings is a good reference, but it’s hard to understand what relies to the OH framework and what is specific functionality of that binding (some of them are quite complex). I’m try to do some copy&paste, but without really understanding the structure to be filled.

I’ve never done development either, at least on OH.

ok, thx for response. I think a good tutorial could boost development of new bindings, too much struggel (unproductive) at the beginng
e.g I integrated code for the bridge handler, but initialization is not called so I suppose that some config/xml is missing


I encounter exactly the same issue as markus7017 setting up a dev env of OH2 on macOS.

I’m very new to OpenHab, but very interested in looking at it.
For the moment I’m stuck after stating the project : trying to access to http://localhost:8283/ (I changed the default listening port) make my browser loading forever.

Please help, as I’m new to OH, I don’t really know how to start to try to debug this.

Many thanks

Here are logs if it can be useful.

2018-01-21 14:54:28.284 [DEBUG] [s.m.i.r.i.ItemRuntimeActivator:26   ] - Registered 'item' configuration parser
2018-01-21 14:54:28.349 [DEBUG] [.m.t.r.i.ThingRuntimeActivator:26   ] - Registered 'thing' configuration parser
2018-01-21 14:54:28.435 [DEBUG] [.s.r.i.SitemapRuntimeActivator:26   ] - Registered 'sitemap' configuration parser
2018-01-21 14:54:28.468 [INFO ] [org.eclipse.jetty.util.log    :192  ] - Logging initialized @2199ms
2018-01-21 14:54:28.478 [INFO ] [.DefaultJettyAtJettyHomeHelper:159  ] - Configuring the default jetty server with [file:/Users/doume/openhab2-master/git/openhab-distro/launch/home/./etc/jetty.xml, file:/Users/doume/openhab2-master/git/openhab-distro/launch/home/./etc/jetty-http.xml, file:/Users/doume/openhab2-master/git/openhab-distro/launch/home/./etc/jetty-deployer.xml]
2018-01-21 14:54:28.479 [INFO ] [.DefaultJettyAtJettyHomeHelper:164  ] - JETTY.HOME=/Users/doume/openhab2-master/git/openhab-distro/launch/home/.
2018-01-21 14:54:28.479 [INFO ] [.DefaultJettyAtJettyHomeHelper:165  ] - JETTY.BASE=/Users/doume/openhab2-master/git/openhab-distro/launch/home/.
2018-01-21 14:54:28.637 [INFO ] [rg.eclipse.jetty.server.Server:346  ] - jetty-9.3.22.v20171030
2018-01-21 14:54:28.703 [INFO ] [tty.util.ssl.SslContextFactory:290  ] - x509=X509@585453ce(mykey,h=[],w=[]) for SslContextFactory@6350c454(file:///Users/doume/openhab2-master/git/openhab-distro/launch/home/etc/keystore,file:///Users/doume/openhab2-master/git/openhab-distro/launch/home/etc/keystore)
2018-01-21 14:54:28.838 [INFO ] [jetty.server.AbstractConnector:278  ] - Started{SSL,[ssl, http/1.1]}{}
2018-01-21 14:54:28.839 [INFO ] [jetty.server.AbstractConnector:278  ] - Started ServerConnector@6f0e94f1{HTTP/1.1,[http/1.1]}{}
2018-01-21 14:54:28.840 [INFO ] [rg.eclipse.jetty.server.Server:414  ] - Started @2571ms
2018-01-21 14:54:28.840 [INFO ] [.DefaultJettyAtJettyHomeHelper:185  ] - Default jetty server configured
2018-01-21 14:54:28.936 [DEBUG] [.i.PersistenceRuntimeActivator:26   ] - Registered 'persistence' configuration parser
2018-01-21 14:54:29.115 [DEBUG] [.i.r.sse.internal.SseActivator:51   ] - SSE API - SseFeature registered.
2018-01-21 14:54:29.117 [DEBUG] [.i.r.sse.internal.SseActivator:60   ] - SSE API has been started.
2018-01-21 14:54:29.139 [DEBUG] [o.e.s.s.j.i.JsonStorageService:59   ] - Json Storage Service: Activated.
2018-01-21 14:54:29.196 [DEBUG] [s.i.t.m.internal.MDNSActivator:34   ] - mDNS service has been started.
2018-01-21 14:54:29.231 [DEBUG] [.i.t.m.internal.MDNSClientImpl:83   ] - mDNS service has been started (JmDNS-IP-1 for IP
2018-01-21 14:54:29.244 [DEBUG] [s.a.m.timer.internal.Activator:42   ] - started bundle timer.module
2018-01-21 14:54:29.481 [DEBUG] [.e.s.s.m.i.MapDbStorageService:57   ] - Opened MapDB file at '/Users/doume/openhab2-master/git/openhab-distro/launch/home/userdata/mapdb/storage.mapdb'.
2018-01-21 14:54:29.540 [INFO ] [s.i.GenericScriptEngineFactory:37   ] - Activated scripting support for ECMAScript
2018-01-21 14:54:29.542 [DEBUG] [s.i.GenericScriptEngineFactory:38   ] - Activated scripting support with engine Oracle Nashorn(1.8.0_45) for ECMAScript(ECMA - 262 Edition 5.1) with mimetypes [application/javascript, application/ecmascript, text/javascript, text/ecmascript] and file extensions [js]
2018-01-21 14:54:29.543 [INFO ] [s.i.GenericScriptEngineFactory:37   ] - Activated scripting support for AppleScript

I made some more investigations and ServerConnector is locked by Equinox Container

Hi, any new infos how to get the mac environment up and running?
@kubawolanin, @mcloarec, @laohixdxm2016, @richardcw1: May you have an idea?

The following requests come into my mind for know

  • It should be possible to pull the code base for the last stable build rather than the snapshot - I don’t want to deal with compile errors when starting with OH dev
  • Fixing an issue with the karaf core project preventing an error free compile (at least after a fresh eclipse install)
  • The demo setup files should be separated. It’s good to have those samples, but confusing if you start development with tons of logs entries for bindings you are not interested to test
  • And again: A good tutorial and improved template for all types of addons
  • The goal: Get the new guy up to speed as soon as possible

Anyways: I’m making progress on the Rachio sprinkler binding

I did try again to set up the development environment, but this time i used an Ubuntu 16.x as OS. What can i say, the most difficult was to install Oracle Java, i just followed the steps and it worked.

(I used Windows 10 the last few times, absolutely horrible…)


Hi @doume: could you find any additional information from your diagnostics. I saw post with @Kai on Google Groups somewhen in 2016 mentioning a problem with audio initialization and @Kai responded to remote the voice/TTS stuff from the default install to overcome this, but I couldn’t find it again. Note sure if that’s the problem, but maybe is one thing to check.

Hi all,

Sorry for the late answer. I didn’t find any time to digg into. So I asked Google some help. I found out this:

I added this arg to the jvm : “-XstartOnFirstThread” which is supposed to fix this issue :

And it now starts correctly!

As I’m interested in looking deeper into the code of this project, I’m wondering if there are some OH developers on this forum? Or is there another way to communicate with devs?


tried it & works like charme :heart_eyes: :+1::+1::+1::+1::+1:
how to get that into the default eclipe setup? so other don’t run into that problem

I was also annoyed by this error, which from what I researched is not due to Maven itself, but to a way that M2Eclipse implementers found to resolve certain dependency-related issues on previous versions.

It probably needs to be fixed by someone more directly involved with the “Mavenization” of the openHAB code, at least because Eclipse is the recommended IDE (and M2Eclipse is what comes with it). In the meantime, using the Quick fix solution to ignore the error should be good enough as apparently Karaf is not needed to run openHAB from Eclipse.