Is there any github project related to openhab1 core source code?

Is there any github project related to openhab1 core source code, or it simply just github kaikreuzer/openhab-core?

Referenced from readme.md from github openhab-distro,
Eclipse SmartHome Framework: This repo holds the major parts of the core functionality.
openHAB 2 Core: This repo contains a few small bundles that are not part of Eclipse SmartHome, but required for the openHAB runtime. This e.g. contains a compatibility layer for supporting openHAB 1 add-ons.
openHAB 2 Add-ons: Add-ons of openHAB that use the Eclipse SmartHome APIs can be found within this repository. They cannot be used with an openHAB 1.x runtime, since they provide features that the old runtime does not support.
openHAB 1 Add-ons: Add-ons developed for openHAB 1.x. Most of them are working smoothly on the openHAB 2 runtime and thus they are packaged within the distribution.
Eclipse SmartHome Extensions: Since openHAB uses the Eclipse SmartHome framework, it is automatically compatible with all extensions that are available for it and maintained within the Eclipse SmartHome repository. These are usually high-quality extensions that might be even used in commercial products.

Here is my understanding,
1 github openhab
For Openhab 1 addons

2 github openhab2-addons
For Openhab2 addons

3 github kaikreuzer/openhab-core
For openhab2 core

Here is my question,Is there any github project related to openhab1 core source code, or it simply just github kaikreuzer/openhab-core?

Thank you for your concern. Any information will be greatly appreciated.

I beleive that openhab has both the binding and openhab-core for OH 1. There were not separate projects for the two for OH 1.

rikoshak, Thank you for your message.

For openhab in "I beleive that openhab has both the binding and openhab-core for OH 1. ",
are you talking about the github openhab project?

So if that’s the case, do you agree below statement?
1 if I go for OH2, I should go github kaikreuzer/openhab-core for openhab-core and github openhab2-addons for binding?
2 if I go for OH1, I should go github openhab for openhab-core and binding?

Thank you and any information will be greatly appreciated.

Everything for openHAB 1 is here: https://github.com/openhab/openhab

openHAB 2 is split:

The core is Eclipse SmartHome: https://github.com/eclipse/smarthome
Some minor customizations of ESH for openHAB 2: https://github.com/kaikreuzer/openhab-core
Addons created specifically for openHAB 2: https://github.com/openhab/openhab2-addons
The legacy openHAB 1 addons: https://github.com/openhab/openhab
ESH Extensions that do not directly target openHAB 2 but will be compatible: https://github.com/eclipse/smarthome/tree/master/extensions

1 Like

Thank you again for your quick resoponse, rlkoshak.

It looks like openhab2 is customized from ESH, but openhab1 is more like a separate project? Am I correct about that?

As you mentioned that,
Some minor customizations of ESH for openHAB 2:

Is there some simple steps I can follow to build openHAB 2 by myself from? https://github.com/kaikreuzer/openhab-core

Then finally I will get something very much like openhab-offline-2.0.0-SNAPSHOT,
The procedure is very similar to E.g. the kernel compilation process.
For Linux kernel building,
1 we get kernel source code,
2 $make
We will get an executable kernel file.

I understand we can compile binding by $mvn package after two days struggling.
But for the openHAB runtime, or say openHAB core, I am not sure whether this procedure is very complicated or just a couple of commands? It seems I could not find information for that in community forum.

Thank you and any information will be greatly appreciated.

OH 1 was developed first. When Kai and company started work on OH 2, they joined the ESH project and most of what would have become OH 2 core transitioned to ESH.

Search the forum for “build openhab2” or browse through the openhab2 tagged posts and you will find a link with instructions on how to get and build openHab 2. I am not a developer on OH and have not yet even tried to install OH 2.

But yes, the build uses maven which will download dependencies for you.

@rlkoshak,
Thank you for your response and information.

I am very glad to hear that,
Search the forum for “build openhab2” or browse through the openhab2
tagged posts and you will find a link with instructions on how to get
and build openHab 2. I am not a developer on OH and have not yet even
tried to install OH 2.

As you suggested, I use both “build openhab2” and tag openhab2 to do the search.
However, I really have a hard to find out the link you mentioned.
Do you have some idea/clue how to find that post?
E.g. Is that a very long mail? Or some key maintainer reply in that post?

Thank you very much. Any information will be greatly appreciated.

https://www.eclipse.org/smarthome/documentation/development/bindings/how-to.html

@rlkoshak
Thank you for your link.

For your message,
Search the forum for “build openhab2” or browse through the openhab2 tagged posts and you will find a link with instructions on how to get and build openHab 2. I am not a developer on OH and have not yet even tried to install OH 2.

But I am a little bit confusing. Above, you mentioned “build openhab2”, you are talking about something openhab2 binding instead of openhab2 core?

I thought you said there is some instruction within the link to build openhab2 from kaikreuzer/openhab-core.
Is my understanding totally wrong?

Thank you and any information will be greatly appreciated.

Here is a link to the “old” way to develop against openHAB 1. You can see it’s been replaced with the new information that pertains to openHAB 2 at this link. You can still develop openHAB 1 style bindings and other addons in the new IDE setup.

To build openHAB 1.8 (latest), you can clone the openhab/openhab repo (or your own fork of it), checkout the 1.8 branch, and run mvn clean install.

@watou,
Thank you very much for your reply.

Your second paragraph is exactly I am looking for.
I am very glad we are able to build up from source code for openHAB1 via openhab/openhab.git.

Do you have some idea of how we do the same thing, meaning building from github source code for openHAB2?
As I was told, openHAB2 is based from eclipse smarthome, openhab-core, openhab1-addons, openhab2-addons these projects.
Although we can easily get a running version by openhab-distro.
But, if we want to build from github source code, is there steps to do that?

As you told me i can just download openhab/openhab repo and run mvn clean install to build,
It seems I can do the same thing for the openhab-distro repo.

My another question is,
Is there any difference for building procedure from these two repositories?
For example, is that openhab/openhab repo do source code compilation and openhab-distro only download pre-built packages?

Thank you and any information will be greatly appreciated.

Hi watou,

As I follow your instructions to checkout 1.8 branch,
$ git branch -a
** 1.8**
** master**
** remotes/origin/1.5**
** remotes/origin/1.6**
** remotes/origin/1.7**
** remotes/origin/1.8**
** remotes/origin/HEAD -> origin/master**
** remotes/origin/master**

Then do mvn install
$mvn install

I understand that distribution-1.8.2-SNAPSHOT-runtime.zip is under openhab/distribution/target directory.
However, as you may notice, if I launch “mvn install”, it really may cost a very long time to do all the things, especially the testing stage.

I am trying to just do simple, actually just one line modification, then run my modification.
For example,
$vi ./bundles/config/org.openhab.config.core/src/main/java/org/openhab/config/core/ConfigDispatcher.java +172
-logger.warn(“Main openHAB configuration file ‘{}’ does not exist.”, mainConfigFilePath);
+logger.warn(“MainMain openHAB configuration file ‘{}’ does not exist.”, mainConfigFilePath);

Up to now, I have tried something below to do compilation and distribution zip file re-generated,
$mvn -pl bundles, distribution install
$mvn -pl targetplatform install

Then, I extract the new distribution-1.8.2-SNAPSHOT-runtime.zip
$cd
$unzip …/distribution-1.8.2-SNAPSHOT-runtime.zip
$./start.sh

However, I could not see my modificaiton take effect.
Still see “Main openHAB configuration file ‘configurations/openhab.cfg{}’ does not exist” instead of "MainMain openHAB configuration file ‘configurations/openhab.cfg{}’

Can anybody provide some suggestions? Or just point out my method is not a reasonable way to do this thing?

Thank you and any information will be greatly appreciated.

1 Like

I think these steps should work (you will of course need to have mvn, git and the JDK installed):

git clone https://github.com/openhab/openhab.git
cd openhab
git checkout 1.8
# edit the source code as you wish
mvn clean install
# the build output should now exist under the distribution directory

Hi watou,
Thank you for your detailed command line steps.

I believe I have already finished the steps you have mentioned on my first build.

I understand that distribution-1.8.2-SNAPSHOT-runtime.zip is under openhab/distribution/target directory after a clean building, as “mvn clean install”.
However, as you may notice, if I launch “mvn install” or “mvn clean install”, it really may cost a very long time to do all the things, especially the testing stage.

My purpose:
I am trying to find some fast way to do the re-build, meaning not the first build, if I only do one line modification in .java source file.

That’s why I am trying to use
$mvn -pl install
to shorten the building process, especially skip the testing stage.

Up to now, I have tried something below to do compilation and distribution zip file re-generated,
$mvn -pl bundles, distribution install
$mvn -pl targetplatform install

Then I extract the new distribution-1.8.2-SNAPSHOT-runtime.zip.
$cd
$unzip …/distribution-1.8.2-SNAPSHOT-runtime.zip
$./start.sh

However, I could not see my modification have taken effect.
For example,
$vi ./bundles/config/org.openhab.config.core/src/main/java/org/openhab/config/core/ConfigDispatcher.java +172
-logger.warn(“Main openHAB configuration file ‘{}’ does not exist.”, mainConfigFilePath);
+logger.warn(“MainMain openHAB configuration file ‘{}’ does not exist.”, mainConfigFilePath);

I Still see “Main openHAB configuration file
’configurations/openhab.cfg{}’ does not exist” instead of "MainMain
openHAB configuration file ‘configurations/openhab.cfg{}’.
(Note: I add an extra “Main” in the string as my modification)

Here is my question,
Is that “mvn clean install” the only way to do the re-build, even if I only have one line modification in the .java source code file?

In comparison, I remember in the past when I build linux kernel, if I only re-build only for one modification source file .c, $make will be very fast as they only re-compile that modified .c file instead of all the source file.
Is that some method to do the similar thing in openHAB by maven?

Thank you and any information will be greatly appreciated.

I’ve got same question here. Trying make some changes to OH1 core io multimedia to stabilize it on Pine64.
The problems I have:

  1. By default core OH1 code is not imported into eclipse as projects, only add-on bindings are
  2. Can’t figure out how to build OH1 packages with changes, standard mvn build only builds bindings but not multimedia core plugins
    @Kai & team, would appreciate some guidance on this

Hi Vlad,

If you checkout the 1.8 branch of the openhab/openhab repo (or your fork, more likely), then a top-level mvn clean install will build the latest openHAB 1.8 distribution snapshot.

The only IDE support for openHAB 1.8 that I’m aware of are the old IDE setup instructions that used Yoxos. I’ve not tried it lately and it may be difficult to set up (in fact, it was always difficult to setup in my memory).

@watou When I ran “mvn clean install” it builds the bindings, but not the core features (like the core “io.multimedia”).
I’ve reviewed the pom xml’s, they do not include the sub-projects for those and pom xmls do not exist for those projects in the repository so it seems to be by design.
What am I missing?
Thanks

This may be a recent regression from a PR cherry picked onto the 1.8 branch. @teichsta, any chance this happened with the copyright header PR? Sorry I can’t check at the moment.

@vgoldman, do you have a moment to see if the pom.xml changes happened here?