Relation between openhab and openhab-core

Hi guys I am new to openHAB. I am really curious about how openHAB is implemented so I just downloaded the source coude of openHAB from github, which is openhab-core. I also learn maven but there are too many modules in this project. My question is:
how does this huge fantastic maven project transform to the karaf binary file which can be executed on my Mac?
I am curious about how to read the openhab-core source codes, but now I can not find any entry point like the main function in C program. Can anyone give me some advice?

The released versions are built on Jenkins. https://ci.openhab.org/

openHAB is an application that is packaged into a series of OSGI bundles and run on the Karaf application server. The “main” that you are looking for resides in Karaf and not openHAB. So I think the main place to start is to go research how OSGI bundles work and are deployed which should give you some orientation to understand the OH source code.

1 Like

Here is a good starting point, with lots of links… https://www.openhab.org/docs/developer/osgi/osgi.html. The rest of the developer docs are also useful.

4 Likes

Thanks a lot! I appreciate people here are very knowledgeable and enthusiastic and I will learn it!

Thank you so much!

1 Like

Hi Bruce, I checked the other answers which said OSGI. Could you please tell me what the realtion between Jenkins you mentioned and the OSGI? Or Can I only build my oepnHAB on Jenkins?

I think Jenkins is just the automated build system used to produce this modular product. I know the IH build system was completely redesigned between Milestones 1 & 2 of 2.5.
As a relative newbie I do not know a lot of the details.

Hi Rich, I want to ask if there is any way I can debug the openHAB core? Suppose I want to modify the code of one bundle, what is the routine to run karaf and openHAB with new core? Should I compile the core of openHAB first, then put it somewhere?

Assuming you use Eclipse:

  1. Clone the openhab-core repository in your git directory
  2. Import the bundle you want to modify/debug
  3. Place a breakpoint and run the demo application.
  4. If it stops at the breakpoint, but doesn’t show the source, click the button to link the source and browse to the bundle project you imported.
1 Like

Thanks hilbrand and I will try. However when I configured the IDE I faced some problems… I followed the instruction, but something bad happened. Can you help me and give me some hints?