working on OpenHAB bindings is really frustrating. Again, I encountered quite a few problems, resuming my work on my downstream-project:
I just set up a new IDE and found out that the newest Eclipse does not work. After some tries I got it running with Eclipse Oxygen, but why don’t you state it clearly here?
Yes, I see that “Mars” is in the screenshot, but screenshots are not so easily replaced and it does work with Oxygen – maybe even others. Hence, I recommend that you add a list of supported (known to work) Eclipse versions. If you don’t manually select anything here, the installer chooses the newest version – which ends in an error
Also it is important to clear everything after a setup attempt failed! It seems the installer keeps quite a few files cached, so after it failed once, it also failed with Mars and Neon – until I cleared everything and tried it with Oxygen. Maybe the others work, too – not sure, if they’re broken or if it’s a problem with old files in a cache.
Furthermore, in order to see how I have to update my pom.xml files, I created a new project using the skeleton.
I followed your docs:
mvn clean install fails and the steps described under “Implement the Binding” are not sufficient to get it running! Anyway, a skeleton should run out of the box!!! Why the hack do I have to manually fix things?
Now it complains about the “/** Copyright …” header in the Java files being wrong. WTF???
I’ll write more about all this later. Now, I have to leave…
This year on the Smarthome day there was a podium discussion about the build system, its perception for new users and its weaknesses. There were two alternative variants presented. I’m pretty sure it will change for good, maybe even for OH 2.5 already.
thanks for the quick response! I really hope that you switch to a more stable and robust build system, soon.
After quite some trial-and-error-rounds I got all running except for one last thing. It does not like “org.eclipse.smarthome.model.sitemap,” in my “Import-Package:” in the MANIFEST.MF, anymore:
[INFO] Fetching p2.index from https://dl.bintray.com/openhab/p2/openhab-deps-repo/1.0.38/ (172B)
[INFO] Fetching p2.index from https://dl.bintray.com/openhab/p2/openhab-deps-repo/1.0.38/ (172B)
[INFO] Adding repository https://dl.bintray.com/openhab/p2/openhab-deps-repo/1.0.38
[INFO] Resolving dependencies of MavenProject: org.openhab.binding:org.openhab.binding.intellihouse:2.5.0-SNAPSHOT @ /home/mn/workspace/openhab.2/git/intellihouse/house.intelli/org.openhab.binding.intellihouse/pom.xml
[INFO] {osgi.os=linux, osgi.ws=gtk, org.eclipse.update.install.features=true, osgi.arch=x86}
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: org.openhab.binding.intellihouse 2.5.0.qualifier
[ERROR] Missing requirement: org.openhab.binding.intellihouse 2.5.0.qualifier requires 'java.package; org.eclipse.smarthome.model.sitemap 0.0.0' but it could not be found
[ERROR]
[ERROR] See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help.
[ERROR] Cannot resolve dependencies of MavenProject: org.openhab.binding:org.openhab.binding.intellihouse:2.5.0-SNAPSHOT @ /home/mn/workspace/openhab.2/git/intellihouse/house.intelli/org.openhab.binding.intellihouse/pom.xml: See log for details -> [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] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException
This worked before and I saw that other plugins still declare a dependency on this package. Well, fortunately, this was left from an unnecessary experiment. For now, I can remove it.
Also what is extremely weird: I have to re-declare this repository in my pom.xml:
I don’t understand why, but without it, none of the dependencies is found. It is pretty clear to me that I must add a repository-declaration for my parent-POM:
That never worked for me in new installation, and I’m doing those quite regularly. I know how to fix it by now, but as a beginner you can always just run maven again (which takes ages, I know :/).
I’m not a beginner when it comes to OSGi and Eclipse. I have worked for large energy businesses, banks and the like. My colleague and I even fixed bugs in tycho
But I never encountered such an instable environment as the one of OpenHAB, before. The P2 architecture definitely sucks, but there are ways to cope with it. It’s a pity that OpenHAB does not manage to keep the build environment stable
For my smart-home-system (a separate downstream-project based on OpenHAB + Raspberry-Pi-sattelites) https://github.com/intellihouse/intellihouse I build all the OSGi bundles (except for the actual OpenHAB-binding itself) using Gradle with the osgi-plugin. So I do not have to write any MANIFEST.MF myself. They’re all auto-generated. This saves heaps of time! I don’t understand why people go the other way around.
Before I used Gradle – i.e. with Maven --, I used the maven-bundle-plugin for doing the same job (e.g. in Cumulus4j – see this pom.xml).
This whole P2 stuff sucks so badly, I don’t even know the words to describe it appropriately! I was working the entire day on it. So why did it even re-download this file again?
It seems their server is broken. But as said: I HAD THIS FILE!!! There was absolutely no need to re-download it. P2 totally sucks! Btw. Maven does not re-download releases if you don’t explicitly force it.
openHAB uses eclipse smarthome as framework (was transferred about 2 years ago to the eclipse foundation) and of course the full eclipse ecosystem is used (PDE, P2 etc). You cannot develop for eclipse smarthome without using eclipse even (without writing your own build system and runtime config at least).
But as I said, that topic was discussed on the podium discussion.
…and: Yabbadabbadooo! I finally finished, today! My PV system’s current state is now nicely shown in OpenHAB. Statistics and charts (over historic data – keeping it in a DB is already implemented) are going to be addressed in my next holidays
Since I have not attended this podium discussion, I have no idea what solutions were discussed, but I want to suggest a very simple one:
It would make sense to mirror all dependencies from eclipse (and other external P2 deps) into an own, separate P2 repository. We did this in basically all projects involving P2, before; i.e. we avoided referencing/including external repositories. Simply mirroring the dependencies (i.e. copy what we need into our own) made sure that we controlled 100% ourselves, when our binary repositories changed – and of course we used a separate such repository for every (active) release. This way, we guaranteed that old versions could still be compiled and that it was absolutely impossible to break an old version while working on a new one.
Is there anything about this podium discussion online? Was there a final solution chosen already, or is there still a discussion ongoing? In both cases: Where’s this documented?
I really like OpenHAB for its clean codebase, its architecture and a few more things (that’s why I chose it).
But to use P2 the way it is used definitely must be changed. The current situation prevents me 100% from doing small changes outside my holidays. I cannot work for 1 or 2 hours in the evening on my smart-home, because – after a few weeks/months of inactivity – I usually need already 1/2 day (or longer!) to get my dev environment running. Such large overhead might be acceptable for a professional project (where I work everyday full time), but it is a show-stopper for a hobby project.
Finally, I wish you and all other OpenHABers a happy, healthy, successful & fulfilled 2562!!!
Nothing online, but Deutsche Telekom presented a migrated eclipse smarthome repo using BND, another user presented a maven-only solution (using bnd internally) and I have personally also performed a Gradle conversion of the repo. Things are moving, trust me. When eclipse smarthome is using a different build system, migrating openhab2-addons is not that much more effort.